Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between uppercase Object and lowercase object? [duplicate]

Tags:

c#

types

class

Possible Duplicate:
c#: difference between “System.Object” and “object”

Although I am currently working with C#, this question could possibly apply to other languages.

Is there any difference between invoking Object vs. object? Specifically, I was creating an instance of Dictionary with the constructor:

Dictionary<String, Object> foo = new Dictionary...

The IDE automatically filled in new Dictionary<string, object>. I went back and changed my initial declaration but it got me wondering.

  • Are there any adverse reactions when I use uppercase String or Object versus lowercase string or object?
  • I'm assuming that uppercase refers to the class (so I can therefore access class methods) whereas lowercase simply refers to the type. Is this true?
like image 967
Jason L Avatar asked Jul 05 '12 20:07

Jason L


1 Answers

object is a keyword (alias) for System.Object, the same applies to string.

When compiled it will be exactly the same thing.

On the MSDN page for object it says the following:

The object type is an alias for System.Object in the .NET Framework. You can assign values of any type to variables of type object.

You can find a long list of all the keywords in C# on MSDN.

like image 169
Filip Ekberg Avatar answered Sep 19 '22 12:09

Filip Ekberg