开发者

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

开发者 https://www.devze.com 2023-01-05 22:00 出处:网络
\"object\" here should refer to the \"Object\" class. As with all class identifiers in the .NET framework, it is supposed to be capitalis开发者_如何学Ced although not case sensitive. But I realise in

"object" here should refer to the "Object" class. As with all class identifiers in the .NET framework, it is supposed to be capitalis开发者_如何学Ced 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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号