473,672 Members | 2,603 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 parameterizedon e) the default one is NOT displayed thus

giving the FALSE impresison that it DOES NOT exist.

BUG
Jul 21 '05 #1
4 1403
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.

"news.microsoft .com" <di********@dis cussion.microso ft.com> wrote in message
news:eY******** *****@TK2MSFTNG P11.phx.gbl...
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 parameterizedon e) the default one is NOT displayed thus

giving the FALSE impresison that it DOES NOT exist.

BUG

Jul 21 '05 #2

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.
"Marina" <nospam> wrote in message
news:uM******** ******@TK2MSFTN GP10.phx.gbl...
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.

"news.microsoft .com" <di********@dis cussion.microso ft.com> wrote in message news:eY******** *****@TK2MSFTNG P11.phx.gbl...
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 parameterizedon e) the default one is NOT displayed thus

giving the FALSE impresison that it DOES NOT exist.

BUG


Jul 21 '05 #3
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.

"news.microsoft .com" <di********@dis cussion.microso ft.com> wrote in message
news:eG******** ******@tk2msftn gp13.phx.gbl...

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.
"Marina" <nospam> wrote in message
news:uM******** ******@TK2MSFTN GP10.phx.gbl...
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.

"news.microsoft .com" <di********@dis cussion.microso ft.com> wrote in

message
news:eY******** *****@TK2MSFTNG P11.phx.gbl...
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 parameterizedon e) the default one is NOT displayed thus

giving the FALSE impresison that it DOES NOT exist.

BUG



Jul 21 '05 #4

"news.microsoft .com" <di********@dis cussion.microso ft.com> wrote in message
news:eY******** *****@TK2MSFTNG P11.phx.gbl...
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 parameterizedon e) 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.

--
Peter - [MVP - Academic]
Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2109
by: Peter van der Goes | last post by:
When a struct is created in C# and a parameterized constructor defined, the IntelliSense editor shows only the syntax for the parameterized constructor in tooltips, but not for the default constructor which appears to still exist. If this is not designed behavior, is it a bug or am I misusing my struct? If it is by design, could you please explain? I realize the behavior of a struct, as regards constructors, is different from that of...
9
3958
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it will not set the value of the control and will leave the checked status of the checkbox to false when a user selects a new date. this works fine when using the control on a win2k machine but if we use it on a win XP box and call
4
1063
by: news.microsoft.com | last post by:
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
4
1738
by: mario.rossi | last post by:
Hi all, I am trying to invoke the default constructor from another, parametrized, constructor, but the default constructor doesn't get invoked at all, I saw. Is this correct ISO C++ behaviour or my compiler has a ++bug (overflowing)? struct Test { int x; int y; // Test() {
74
15972
by: Zytan | last post by:
I have a struct constructor to initialize all of my private (or public readonly) fields. There still exists the default constructor that sets them all to zero. Is there a way to remove the creation of this implicit default constructor, to force the creation of a struct via my constructor only? Zytan
0
8486
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8828
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6238
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.