[Mono-list] Constructors in C#
Joe Audette
joe_audette@yahoo.com
Fri, 19 Nov 2004 11:08:46 -0800 (PST)
--0-1278980226-1100891326=:95206
Content-Type: text/plain; charset=us-ascii
ok,
How about this:
public class MyClass
{
private string member;
public MyClass ()
{
DoStuff("stuff");
}
public MyClass (String s)
{
DoStuff(s);
}
private void DoStuff(string s)
{
this.member = s;
}
}
Joe
Brice Carpentier <brice@daknet.org> wrote:
Joe Audette wrote:
> The java example should work as is in C#
>
well, doing this way, I get error CS0119 : "Expression denotes a
`variable' where a `method group' was expected"
Regards,
--
Brice Carpentier aka Br|ce
_______________________________________________
Mono-list maillist - Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list
joe_audette@yahoo.com
http://www.joeaudette.com
http://www.mojoportal.com
--0-1278980226-1100891326=:95206
Content-Type: text/html; charset=us-ascii
<DIV>ok,</DIV>
<DIV> </DIV>
<DIV>How about this:</DIV>
<DIV> </DIV>
<DIV>public class MyClass<BR>{<BR> private string member;</DIV>
<DIV> public MyClass ()<BR> {<BR> DoStuff("stuff");<BR> }</DIV>
<DIV> public MyClass (String s)<BR> {<BR> DoStuff(s);<BR> }<BR> <BR> private void DoStuff(string s)<BR> {<BR> this.member = s;<BR> <BR> }<BR>}</DIV>
<DIV> </DIV>
<DIV>Joe<BR><BR><BR><B><I>Brice Carpentier <brice@daknet.org></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Joe Audette wrote:<BR>> The java example should work as is in C#<BR>> <BR>well, doing this way, I get error CS0119 : "Expression denotes a <BR>`variable' where a `method group' was expected"<BR><BR>Regards,<BR>-- <BR>Brice Carpentier aka Br|ce<BR>_______________________________________________<BR>Mono-list maillist - Mono-list@lists.ximian.com<BR>http://lists.ximian.com/mailman/listinfo/mono-list<BR></BLOCKQUOTE><BR><BR>joe_audette@yahoo.com<br>http://www.joeaudette.com<br>http://www.mojoportal.com
--0-1278980226-1100891326=:95206--