C
Chris Edgington
I'm a C/C++ programmer diving into VB.NET. Is there a
VB.NET equivalent to a C/C++ #define macro? For example, I
have 15 variables that I need to do the same thing to ....
in C, I'd do the following:
#define VALIDATE_AND_INIT(zMember, zNew) \
if (zNew == NULL) \
strcpy(zMember, ""); \
else \
strcpy(zMember, zNew);
Then in my code I could go:
VALIDATE_AND_INIT(FirstName, NewFirstName);
VALIDATE_AND_INIT(LastName, NewLastName);
....
Thereby making a large block of repeated code much more
manageable and easier to read and understand.
Does VB.NET provide such a mechanism?
Thanks,
-Chris
VB.NET equivalent to a C/C++ #define macro? For example, I
have 15 variables that I need to do the same thing to ....
in C, I'd do the following:
#define VALIDATE_AND_INIT(zMember, zNew) \
if (zNew == NULL) \
strcpy(zMember, ""); \
else \
strcpy(zMember, zNew);
Then in my code I could go:
VALIDATE_AND_INIT(FirstName, NewFirstName);
VALIDATE_AND_INIT(LastName, NewLastName);
....
Thereby making a large block of repeated code much more
manageable and easier to read and understand.
Does VB.NET provide such a mechanism?
Thanks,
-Chris