Is a good practice to initialize private data members from within ctor by calling the associated pro

Posted by yuko.aihara on Stack Overflow See other posts from Stack Overflow or by yuko.aihara
Published on 2010-04-14T01:50:10Z Indexed on 2010/04/14 1:52 UTC
Read the original article Hit count: 243

Filed under:
|
interface IAnimal
{
    string Name { get; set; }
}

class Dog : IAnimal
{
    private string name;
    public Dog(string name)
    {
        Name = name;
    }

    public string Name
    {
        get { return name; }
        set { name = value; }
    }
}

© Stack Overflow or respective owner

Related posts about property

Related posts about c#