T
Timothy V
Hi,
Is there a C# equivelant to VB's with keyword?
Thanks,
Tim.
Is there a C# equivelant to VB's with keyword?
Thanks,
Tim.
Mark R. Dawson said:Hi Timothy,
nope, no such equivalent for VB's with statement in C#.
Good ridence I say![]()
Michael said:Good ridence I say
Michael
rkc said:Care to explain why "Good ridence I say"?
JaredHite1 said:The With keyword, like anything else, is a tool that can be used wisely
or unwisely. I think it can increase or decrease readability,
depending on how it's used. Although I don't use it much myself, I do
think that as a shortcut for initializing many properties of an object,
it's very useful and its use results in more readable code than
referencing the same variable over and over.
"it is actually slower (it's a myth that it's faster). "
Can you please point me to a benchmark or article that proves it? Just
an educated guess, but I would speculate that the With keyword compiles
to close to the same, if not identical, IL as multiple object
references.
JaredHite1 said:The With keyword, like anything else, is a tool that can be used wisely
or unwisely. I think it can increase or decrease readability,
depending on how it's used. Although I don't use it much myself, I do
think that as a shortcut for initializing many properties of an object,
it's very useful and its use results in more readable code than
referencing the same variable over and over.
"it is actually slower (it's a myth that it's faster). "
Can you please point me to a benchmark or article that proves it? Just
an educated guess, but I would speculate that the With keyword compiles
to close to the same, if not identical, IL as multiple object
references.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.