Possible Duplicate:
String vs string in C#
I have a simple scenario where I am binding a grid to a collection of objects that will be stored in a list. The question that I was wondering is what is the best practice for declaring a list of objects?
IList<object> myCollection;
or
IList<Object> myCollection;
I've read some code standards articles and a lot of people suggest using String vs string so I was wondering if the same rule applies here and why? What is different about the two methods (if anything) and what kind of performance gains are there for doing it one way vs the other.
This grid is part of a custom control where the list is exposed as a property that will be bound to the grid.
string and object are keywords of the C# language and resolve to System.String and System.Object classes respectively.The theoretical advantage of using object over Object is that you are lowering the dependency on the Base Class Library. However, since BCL is a core part of .NET Framework the practical “advantage” is avoiding using System; in simple cases. Such “advantage” is IMHO disputable.
There's no difference, the lowercase object is an alias for the Object class, as the lower case string is an alias for the String class, int for Int32 etc.
already answered in the best way:
String vs string in C#
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With