0

In c#, how to implement functions like c++ macro define?

Macro define very funny and flexible in c++,it makes code very very concise and simple. But in c#,there are only macro declarations,unable to use macro flexible like c++. Maybe attribute in c# can do something like macro in c++,but I don't be familiar with it. From c++ to c#,can't use macro,I feel like lost something...... so......how to use something in c# like macro in c++?

10th May 2018, 8:57 PM
Bluebear
Bluebear - avatar
2 Antworten
0
c# does not have macros like in c++ because it is a much higher level language, and thus is father from the hardware of the device. the closest thing to preprocessor macros in c# are snippets
10th May 2018, 9:06 PM
hinanawi
hinanawi - avatar
+ 1
@hinanawi very thanks,very useful,snippet is a new word for me. after some basic stuff,i thought snippet maybe not flexible like macro.
10th May 2018, 9:23 PM
Bluebear
Bluebear - avatar