Re: scope of List<Queue> different?
Quote:
Originally Posted by
nelo
I've noticed for example that in the current project the team leader prefers 'String' to 'string' so I've adopted that recently
Funnily enough, these are actually two different things. Take this example:
Code:
namespace Blah {
// This class represents a 'string' from 'String Theory'
public class String
{
public String () {}
}
public void Method ()
{
String s = "fail"; // WHOOPS! This won't compile
string s = "win!" // This does work
}
}
The thing is, 'string' is essentially a typedef to System.String as defined in the core library (mscorlib.dll). It is impossible for anyone to override this and replace it with another class.
'String' means the class with the name 'String' which is available in the current namespace or in one of the namespaces listed in the 'using' statements at the top. As you can see above, this is not guaranteed to be 'System.String' as declared in mscorlib.
The same is true for int/Int32, long/Int64, short/Int16. Each of those keywords is guaranteed to link the corresponding value type as declared in mscorlib, but each of those class names is whatever class is in the current namespace.
It's a small point, but worth noting :)
Re: scope of List<Queue> different?
That's a very good point! As you said small but worth noting. I might revert back to using to the 'string'. Generally speaking I have visibility of the entire code base so I'm unlikely to come across a 'String' other than 'System.String' but still you raise a good point.
Re: scope of List<Queue> different?
For what it's worth, I use String when I'm using the static members of the class (e.g. String.Format); otherwise I use string.