|
-
May 13th, 2006, 06:02 PM
#1
Thread Starter
Hyperactive Member
[2.0] slight confusion between "Object" vs "object"
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
-
May 13th, 2006, 06:56 PM
#2
Re: [2.0] slight confusion between "Object" vs "object"
"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.
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
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.
Last edited by jmcilhinney; May 13th, 2006 at 06:59 PM.
-
May 13th, 2006, 08:30 PM
#3
Thread Starter
Hyperactive Member
Re: [2.0] slight confusion between "Object" vs "object"
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
-
May 13th, 2006, 09:32 PM
#4
Re: [2.0] slight confusion between "Object" vs "object"
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:
The object type is an alias for Object in the .NET Framework.
where "Object" is a link to the topic for the System.Object class.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|