Reputation: 24572
Here's what I am doing right now:
public static class CONST
{
public static bool CarTmr = false;
Is this another way to do this that is more commonly used?
Upvotes: 0
Views: 134
Reputation: 26430
I'd go with the Microsoft recomended way
static class Constants
{
public const double Pi = 3.14159;
public const int SpeedOfLight = 300000; // km per sec.
}
// Accessible like
double area = Constants.Pi * (radius * radius);
So in your case:
public static class CONST
{
public const bool CarTmr = false;
}
Depending on the situation, you could also setup a class that reads from the configuration, if those constants relate to runtime and might be changed in the future.
There is no Xamarin
specific, better way to achieve it.
Upvotes: 1