Is string.Length in C# (.NET) instant variable?

前端 未结 4 1109
陌清茗
陌清茗 2020-12-11 16:24

I\'m wondering if string.Length in C# is an instant variable. By instant variable I mean, when I create the string:

string A = \"\";

A = \"Som          


        
4条回答
  •  旧巷少年郎
    2020-12-11 16:40

    It looks like it is a property of string, which is probably set in the constructor. Since it is not a function, I doubt that it is computed when you call it. They are simply getting the value of the Length property.

提交回复
热议问题