How to use Fluent style syntactic sugar with c# property declaration

Posted by Thomas on Stack Overflow See other posts from Stack Overflow or by Thomas
Published on 2012-12-07T10:55:18Z Indexed on 2012/12/07 11:03 UTC
Read the original article Hit count: 319

Filed under:
|

i never use fluent style code before. so first time i tried to develop Fluent style with c# property declaration but getting error. can any one help me.

public class MailTemplate
{
    string _MailBody = "";
    public MailTemplate MailBody
    {
        get { return _MailBody; }
        set { _MailBody = value ; }
    }

    string _Subject = "";
    public MailTemplate Subject
    {
        get { return _Subject; }
        set { _Subject = value; }
    }

    string _MailFrom = "";
    public MailTemplate MailFrom
    {
        get { return _MailFrom; }
        set { _MailFrom = value; }
    }
}

please help me how could assign or initialize mail body and later also can read with same property name. i think proeprty can not be use in case of fluent style development. need some light here. thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about fluent