how to init values in structure?

P

Peter Rilling

Okay, I have a structure where I want to initialize the fields to some
special value, but I cannot initialize them directly (e.g. private bool
myBool = false) and I cannot create a defauld constructor.

Is there anyway I can do this? I know that I could make this a class rather
then a structure, but I would like it to be a value type.
 
K

Karl Seguin

No, though god knows you could have a constructor with a single parameter
"bool initializeDefault" and just do a bunch of stuff in there

public Coordinate(bool initializeDefault)
{
x = 3;
y = 2;
}

I feel dirty though...

Karl
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top