Initialize non-static members

B

Bumbala

Hello,
Is it possible to initialize non-static members inside a value class
(structure) ?

Thanks.
 
B

Ben Voigt

Bumbala said:
Hello,
Is it possible to initialize non-static members inside a value class
(structure) ?

Thanks.

No. The constructor for a .NET value type isn't guaranteed to be called, so
it's forbidden to define a default constructor, copy constructor, assignment
operator, etc.
 

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