Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can you macro in C#/.NET?
Message
 
 
To
29/05/2012 10:46:18
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01544610
Message ID:
01544617
Views:
37
Thank you.

>You can't macro expand in C# like you do in VFP.
>
>In this case, it's preferred to use an enum rather than pass a string.
>
>
>enum ParameterDirection {Input, InputOutput, Output}
>
>
>Then you can do
>
>param.Direction = ParameterDirection.Input;
>
>
>
>>Hi,
>>
>>Before I do the IF/ELSE, or SWITCH, I am wondering if I could macro expand in C#. Here is an example. I am passing a value of ParameterDirection as a string (e.g. 'Input', 'InputOutput', 'Output') I need to set ParameterDirection based on the passed value.
>>
>>Here is the pseudo code:
>>
>>
>>string cDirection = 'Input';
>>param.Direction = ParameterDirection. + 'cDirection';
>>
>>
>>I am pretty sure that the above syntax will not work. But is there way to make it work? TIA.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform