Public Constants

If you want to use a constant outside of a class then you can declare it as public
This allows it to be accessed by fully qualifying it with the class name
Constants can be marked as public, private, protected, internal or protected internal.

public class MyClass 
{
   public const double values = 3.5;
}
MessageBox.Show(MyClass.values);


© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext