BUG: struct default constructor is not displayed on intellisense yet it is available, BUG

N

news.microsoft.com

BUG: struct default constructor is not displayed on intellisense yet it is
available, BUG



Make a struct type with a parameterized constructor.

Try to construct the type in the IDE and check for the 2 overloads (Default
AND the parameterizedone) the default one is NOT displayed thus

giving the FALSE impresison that it DOES NOT exist.



BUG
 
M

Marina

A struct always has a default constructor, since structs are value types.
As soon as you declare one, all the fields are initialized - so it is as if
you called it, without really having to call it.

You can argue that this is a bug, but it seems like it may have been a
deliberate decision to leave it out, given the behavior of structs.
 
N

news.microsoft.com

Well since it can be constructed with

SomeStruct newStruct = new SomeStruct();

I would think that it would have shown this in intellisense. I am aware that
structs only can have theyre own default constructor and you cant override
it, and if you have a parameterized one ALL fields must be set before going
out of scope.

However its the same with classes, here you can just let the system supply
the DEFAULT constructor (like structs .- except theyre by design as system
supplied ONLY) but you still see it in intellisnse.

Its an anoyance.
 
N

news.microsoft.com

But there IS a default constructor on structs, its just defined by the
system. Yet intellisense says there is NOT.

Its a BUG, deal with it.
 
P

Peter van der Goes

news.microsoft.com said:
BUG: struct default constructor is not displayed on intellisense yet it is
available, BUG



Make a struct type with a parameterized constructor.

Try to construct the type in the IDE and check for the 2 overloads (Default
AND the parameterizedone) the default one is NOT displayed thus

giving the FALSE impresison that it DOES NOT exist.



BUG
OK, assuming you're talking about C# (I guessed based on one of the groups
you crossposted to), I've replicated the behavior.
Actually, the Microsoft public groups are frequented by Microsoft employees
(implying no official response obligation), so your report has probably been
read already. I'm going to repost the report in a new thread, using a
slightly different approach, and see if a response is forthcoming.
 

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