Reputation: 55
Is it possible to use constants without grouping them in a class? I need to pass some constant configuration values as argument to a method. At this moment my code looks like this:
board.ADCConfig(board.AN0 | board.CH0 | board.TAD2 | board.FOSC6 | board.leftjust);
But I want to do something like this:
board.ADCConfig(AN0 | CH0 | TAD2 | FOSC16 | leftjust);
Grouping all the constants in a separate file.
Upvotes: 2
Views: 98
Reputation: 69270
C# requires everything to be defined within a class so you can't do anything about it.
In the upcoming C# 6 there is a new construct where you can use using
with a class. With using YourApp.board
the syntax you want would be possible.
Upvotes: 5