"with blocks" in c#

G

Griff

Hi

I'm a VB6 developer attempting to learn C# ....and I've stumbled at the
first hurdle of how to use with blocks.

I'm used to writing:

Dim o as someObject

with o.mainProperty
.subProperty1 = "a"
.subProperty2 = "b"
end with

and I can't even figure that out in c#.

Griff
 
G

Guest

Hi Griff,

Unfortunately there is nothing like that in C#. You'll have to address each
property individually.

someObject o = new someObject();
o.subproperty1 = "a";
o.subproperty2 = "b";

HTH
 

Ask a Question

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.

Ask a Question

Top