I have two classes and a method like this:
public class Class1
{
public int Id { get; set; }
public string Name { get; set; }
public Class2 Params { get; set; }
}
public class Class2
{
public string Param1 { get; set; }
public string Param2 { get; set; }
public string Param3 { get; set; }
}
private Class1 GetData(SqlDataReader reader)
{
var model = new Class1
{
Id = Convert.ToInt32(reader["ID"]),
Name = reader["Name"].ToString(),
Class2.
};
}
Why I cannot see the properties of Class2?
Dave is correct. The easiest way to do this with your code is as follows