question

SougataGhosh-7881 avatar image
0 Votes"
SougataGhosh-7881 asked SougataGhosh-7881 commented

Difference between Structure elements and Structure Members

In the MSDN documentation (structures-and-classes) where they discuss similarities of classes and structures, the following is stated:

Both have members, which can include constructors, methods, properties, fields, constants, enumerations, events, and event handlers. However, do not confuse these members with the declared elements of a structure.

Can someone please explain that for a structure in VB, what is a difference between an element of a structure and a member of a structure? The documentation quoted above says that we should not confuse them....and I am very much confused.


Regards
Sougata



dotnet-visual-basic
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

XingyuZhao-MSFT avatar image
0 Votes"
XingyuZhao-MSFT answered SougataGhosh-7881 commented

Hi @SougataGhosh-7881 ,

See : Declared Elements in Visual Basic

A declared element is a programming element that is defined in a declaration statement. Declared elements include variables, constants, enumerations, classes, structures, modules, interfaces, procedures, procedure parameters, function returns, external procedure references, operators, properties, events, and delegates.

Best Regards,
Xingyu Zhao


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I had already checked the link. Whats confusing to me is that they have mentioned literally everything that can be declared as "elements" - variables, constants, enumerations, classes, structures, modules, interfaces, procedures, procedure parameters, function returns, external procedure references, operators, properties, events, and delegates. So if everything is an element then what is a member? - thats my confusion!

0 Votes 0 ·

Hi @SougataGhosh-7881 ,
Thanks for your feedback, the document has been modified to avoid causing more confusion.

0 Votes 0 ·

You are welcome

0 Votes 0 ·
DuaneArnold-0443 avatar image
0 Votes"
DuaneArnold-0443 answered SougataGhosh-7881 commented

However, do not confuse these members with the declared elements of a structure.

Declared means variables, members, etc., etc. are declared at structure initialization and are at the procedural-scope that can be accessed globally as opposed to defining them at the module scope used at the model level only. So it's talking about scope access and do not confuse the two scopes.

An element is anything that is part of the whole. Variables, members, etc. and etc. are elements of a structure or class as a whole, just like your finger a part is an element of your body as a whole.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

Is it possible that you share an example and point out what you think should be considered as "elements" and "members" and the difference between them?

0 Votes 0 ·