Re: Basic info needed on struct in C#
From: Alex (alexware69_at_hotmail.com)
Date: Wed, 24 Mar 2004 14:09:56 -0500
Hi . What you are doing in your example is already done by the default
constructor, so you dont need to initialize all the members to zero.
Instead try changing to nonzero values.
"Gets" <firstname.lastname@example.org> wrote in message
> i am beginner in C# i am currently working on Structures in C#
> i found the following stmt in MSDN for structures in C#
> It is an error to declare a default (parameterless) constructor for a
struct. A default constructor is always provided to initialize the struct
members to their default values.
> i was able o catch the first sentence of it. But the second sentence i am
not able to understand
> i tried with following example
> public struct xxx
> public int i,k;
> public xxx()
> i=0; /* as per second sentence i feel this should excute but its
giving error */
> can anyone help me
> Thanks in advance