简体   繁体   中英

Page_Load(object sender, EventArgs e)---Why is “object” not capitalised?

"object" here should refer to the "Object" class. As with all class identifiers in the .NET framework, it is supposed to be capitalised although not case sensitive. But I realise in c# it is not capitalised by default. Why is that? Is it because C# is modelled after Java which had some sort of non capitalised object class? I can't remember Java syntax already.

object is just a C# keyword that refers to the System.Object class. In just the same way, string is a keyword that refers to the System.String class. You can use the capitalized and non-capitalized versions interchangably, but it helps to highlight that these two classes are treated "specially" by the C# language (in that object is the default class that all classes inherit from, and string is the type of "xyz" constant expressions).

Also, C# is case-sensitive. EventArgs is a different class to eventargs (say).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM