I have this class
public class TextFiller
{
public HtmlText Text { get; set; }
public string Details { get; set; }
}
public class HtmlText {
[AllowHtml]
public string TextWithHtml { get; set; }
}
How can I change the class so that when I do the following it creates a TextFiller instance with TEXT populated with “” and Details populated with “” ?
I assume constructors but I am still learning and would appreciate help. In particular I am confused because I suppose I need to have a constructor for HtmlText also.
As you’ve already guessed, you can set the initial values of properties from within a constructor:
See also: Constructors (C# Programming Guide)