Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to Call Static Constants in c#
How to Call Static Constants in c#
First, a static constant is defined. In C#, static constants must be defined in the class.

Public? Class? MyGlobalConstants

{

Public? Static electricity Read only? String? Name? =? ”ABC”;

Public? Static electricity Read only? int? Count? =? 10000;

Public? Static electricity Read only? Floating? Pi? =? 3. 14f; ?

These static constants can be used anywhere in the program. Usage: Class name. Static constant name.

String? Name? =? MyGlobalConstants。 Name? +? " 123"; ? //? name="ABC 123 "

Floating? Area? =? ( 10* 10)*? MyGlobalConstants。 PI;

……