Question: I have a class `Company`.

Inside my class i want to declare a string `LanguageCode` which gets is value from another class `Language`.

Like this:

```
public class Company : Entity  
{    
    public string LanguageCode
     {  
         get
         {
            Language l = new Language();              
            string language = l.Name;
            return language;
         }
         set { ;}
     }
}

```

When running I am not getting any error but is it correct way to create a new instance of a class in get {};

Answer: 
Properties should not have side effects. You normally don't create instances of other classes there and it makes not sense at all anyway in this case. If you need to execute a method to get the value you probably should use a method to return that value instead of a property. Properties should not be "expensive" and if they need to use another method they should be also a method imho.

I assume you store the name of the language in this class and you want to return the `Language` object according to this name:

```
public class Company : Entity
{
    public string LanguageName{ get;set; }

    public Language GetLanguage()
    {
        Language language = new Language(){ Name = this.LanguageName };
        return language;
    }
}

```
This is not really a good practice, in my opinion, since every time you get the property - the new object is instantiated. 

I would create a private property and store the actual string in it:

```
public class Company : Entity  
{   
    private string _languageCode 
    public string LanguageCode
     {  
         get
         {
            if (String.IsNullOrEmpty(_languageCode) 
            {
               Language l = new Language();              
               _languageCode = l.Name;
            }
            return _languageCode
         }
     }
}

```

That way the `Language` object will only be created once the property accessed the first time.