Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can you macro in C#/.NET?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01544610
Message ID:
01544641
Vues:
32
So far the approach with enum work well and is easy to implement. I will read up on Reflection (I am a newbie in this field).

Thank you for your suggestions.

>You can use Reflection for most expression based single operations. For code you can also compile C# code on the fly although that's a bit of work to make it work and it's fairly slow.
>
>Project Roslyn includes a 'compiler in a box' that provides library functions for dynamic code execution.
>
>+++ Rick ---
>
>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform