J
Juan T. Llibre
OK, guys, usually I answer questions instead of asking them,
but this thing has me scratching my head.
Why is the default for AutoEventWireup different for C# and VB.NET ?
In VS 2005, if I create a new VB website using code-behind, the following Page directive is inserted
:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
If I create a new C# website using code-behind, the following Page directive is inserted :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
Is there a reason for AutoEventWireup's default setting being "false" for VB.NET and "true" for C# ?
I asked this over at the MSDN forums, and PeteL told me this :
"The short answer to your question is that VB does this automatically, where as C# doesn't.
The easiest way to test this is to create a Page_Init method, and put a break point in it.
Then, try flipping the AutoEventWireup, in C# it will only fire when true,
but in VB it fires in either event. VB handles this for you."
My reply was :
"Your explanation tells me what happens, but I already knew that.
Why is there a difference in the way the 2 languages handle that ?
This is confusing to users.
I think this is the first instance I see of a glaringly different way
the 2 main VS.NET languages handle a .Net configuration.
Syntax differences I understand.
Why one .Net language would treat a .Net application's settings in a
different way than another .Net language is a bit more difficult to understand."
So, now I ask all of you :
Why is the default for AutoEventWireup different for C# and VB.NET ?
Why does C# need AutoEventWireup set to "true" while VB.NET can make do with "false" ?
There used to be ( pre v2 ) a difference in the way websites written in VS.NET
handled event wiring, because VS.NET handled the event wiring for you,
while hand-written code needed auto event wiring, but this is the first time
I see that two .Net languages need different settings to handle a .Net application.
Juan T. Llibre
ASP.NET MVP
============
but this thing has me scratching my head.
Why is the default for AutoEventWireup different for C# and VB.NET ?
In VS 2005, if I create a new VB website using code-behind, the following Page directive is inserted
:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
If I create a new C# website using code-behind, the following Page directive is inserted :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
Is there a reason for AutoEventWireup's default setting being "false" for VB.NET and "true" for C# ?
I asked this over at the MSDN forums, and PeteL told me this :
"The short answer to your question is that VB does this automatically, where as C# doesn't.
The easiest way to test this is to create a Page_Init method, and put a break point in it.
Then, try flipping the AutoEventWireup, in C# it will only fire when true,
but in VB it fires in either event. VB handles this for you."
My reply was :
"Your explanation tells me what happens, but I already knew that.
Why is there a difference in the way the 2 languages handle that ?
This is confusing to users.
I think this is the first instance I see of a glaringly different way
the 2 main VS.NET languages handle a .Net configuration.
Syntax differences I understand.
Why one .Net language would treat a .Net application's settings in a
different way than another .Net language is a bit more difficult to understand."
So, now I ask all of you :
Why is the default for AutoEventWireup different for C# and VB.NET ?
Why does C# need AutoEventWireup set to "true" while VB.NET can make do with "false" ?
There used to be ( pre v2 ) a difference in the way websites written in VS.NET
handled event wiring, because VS.NET handled the event wiring for you,
while hand-written code needed auto event wiring, but this is the first time
I see that two .Net languages need different settings to handle a .Net application.
Juan T. Llibre
ASP.NET MVP
============