I am developing a small C # application for fun. I like this language, but something bothers me ...
Is there a way to make #define (C mode) or symbol (ruby mode).
The ruby ββsymbol is very useful. Itβs just some name preceded by β:β (example β: guyβ), each character is unique and can be used by anyone where in the code.
In my case, I want to send a flag (connect or disconnect) to a function.
What is the most elegant C # way to do this?
Here is what I would like to do:
BgWorker.RunWorkersAsync(:connect) //... private void BgWorker_DoWork(object sender, DoWorkEventArgs e) { if (e.Arguement == :connect) //Do the job }
At this point, my favorite answer is the enum solution;)
c # ruby symbols
Nicolas guillaume
source share