while typing using VS 2005, C#, intellisense shows "Object" and "object" .
what is the difference. The help shows both are Object class . then why Uppercase Object and lower case object is displayed by intellisense?
nath
Printable View
while typing using VS 2005, C#, intellisense shows "Object" and "object" .
what is the difference. The help shows both are Object class . then why Uppercase Object and lower case object is displayed by intellisense?
nath
"Object" is a .NET type and "object" is a C# data type. With an upper case "O" it is actually System.Object but without the qualifying namespace. If you remove the "using System;" line from the top of the code file you'll see that you cannot use "Object" anymore. With a lower case "o" it is the the in-built C# object data type. Most languages have in-built data types for the most commonly used types. C# has a number of in-built data types and below is a table of the .NET type that is used to implement implement some of them.
Note that the .NET types turn a light aqua-ish colour in the IDE and the C# data types, like all language key words, turn a bright blue colour.Code:C# data type .NET type
object System.Object
bool System.Boolean
int System.Int32
float System.Single
double System.Double
decimal System.Decimal
string System.String
jm,
can we say object (lower case o which is in-built C# object data type) as an alias for System.Object class?
I meant object (lower case) is alias of Object?
thanks
nath
All C# data types are implemented using .NET types, so an object and an Object are essentially the same thing. VB.NET has its own data types too. A VB.NET Integer and a C# int are both implemented using the System.In32 structure. I suggest that you start making use of your F1 key. Had you typed a line like:then placed your cursor in the "object" word and pressed F1 it would have taken you straight to the help topic for the object data type, which says:Code:object o;
where "Object" is a link to the topic for the System.Object class.Quote:
The object type is an alias for Object in the .NET Framework.