preprocessor - VB.NET Is there a way to create a pre-processor constant that behaves as a simple text substitution? -


vb.net 2010, .net 4

hello,

i (something like) following:

\#const t = "byte()"  public class myclass   inherits somegenericclass(of t)    .. other code .. end class 

and have act same if i'd typed

public class myclass   inherits somegenericclass(of byte())    .. other code .. end class 

it's not have way, i'm curious if such thing possible.

thanks in advance!

brian

no, not possible. visual basic , c# designers decided not allow c-like preprocessor, because felt led lot of errors , confusion. easy write c macros behave in unintended ways, , vb , c# designers felt safety broad range of developers took priority. therefore defines in vb , c# 'defined' or 'undefined' rather having values.

eric gunnerson discusses c# perspective here, , think design reasoning vb.net same.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -