S
Sean Wolfe
I have a request for the c# compiler one that is an obvious oversight in
my opinion. I'm not sure if this is already being implemented in
Whidebey, bu i would hope to find it in there, or in the next version.
Working with properties, and the neaming convention that Microsoft has
recommended for developing in C#, it is easy for one to have a circular
reference. This reference could easily be prevented by a Compiler error,
but as of 1.1 frameworks, it does not.
take the following code for example:
public class Foo
{
private int bar;
public int Bar
{
get{ return this.Bar; } // <-- this should be a
// compiler error.
}
}
This problem is further exaserbated by the fact that the VS.NET IDE's
Intellisense often chooses the Public version of a member before a
private as you are typing.
Another situation arises in which you are trying to access a private
member withing a class while using a property or method and end up using
a public Property. This is a problem because when you meant to access
the private member field, you access the Public Property method and
incur a performance penalty. Teh compiler should thorw warnings if it
detects such behavior.
Take this code for example:
public class Foo
{
private int bar;
public int Bar
{
get{ return this.bar; }
}
public int FooBar(int param)
{
// The following line should throw a warning.
return (this.Bar + param);
}
}
These are common mistakes i see happen in a development team using C#.
They are such subtle mistakes. Ones that a Compiler could pick up
easily. While i really enjoy proramming in this language, and developing
with it. i fear that this is one of the kinds of issues that come up
that makes C# often criticized for not being a language that is useable
in large development projects and teams.
I often feel this is not true, because I feel with some best practices
C# can be a great productivity enhancer. That is from experience in
developing large applicaitions in a team. But these subtle littpe
problems point to otherwise. Please fix this.
Sean
my opinion. I'm not sure if this is already being implemented in
Whidebey, bu i would hope to find it in there, or in the next version.
Working with properties, and the neaming convention that Microsoft has
recommended for developing in C#, it is easy for one to have a circular
reference. This reference could easily be prevented by a Compiler error,
but as of 1.1 frameworks, it does not.
take the following code for example:
public class Foo
{
private int bar;
public int Bar
{
get{ return this.Bar; } // <-- this should be a
// compiler error.
}
}
This problem is further exaserbated by the fact that the VS.NET IDE's
Intellisense often chooses the Public version of a member before a
private as you are typing.
Another situation arises in which you are trying to access a private
member withing a class while using a property or method and end up using
a public Property. This is a problem because when you meant to access
the private member field, you access the Public Property method and
incur a performance penalty. Teh compiler should thorw warnings if it
detects such behavior.
Take this code for example:
public class Foo
{
private int bar;
public int Bar
{
get{ return this.bar; }
}
public int FooBar(int param)
{
// The following line should throw a warning.
return (this.Bar + param);
}
}
These are common mistakes i see happen in a development team using C#.
They are such subtle mistakes. Ones that a Compiler could pick up
easily. While i really enjoy proramming in this language, and developing
with it. i fear that this is one of the kinds of issues that come up
that makes C# often criticized for not being a language that is useable
in large development projects and teams.
I often feel this is not true, because I feel with some best practices
C# can be a great productivity enhancer. That is from experience in
developing large applicaitions in a team. But these subtle littpe
problems point to otherwise. Please fix this.
Sean