How To get objects of MetadataType in other class where we create their type cast
-
9 марта 2012 г. 13:48
public class EmployeeMetaData
[MetadataType(typeof(EmployeeMetaData))]
{
public string _EmpId;
[Required(ErrorMessage = "Enter EmployeeId.")]
[StringLength(5, ErrorMessage = "EmpId Is Not More Then 5 Characters.")]
public string EmpId
{
get
{
return _EmpId;
}
set
{
_EmpId = value;
}
}
}
public class Employee
{
}Default.aspx
protected void Page_Load(object sender, EventArgs e)
{
try
{
Employee objEmployee = new Employee();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
} Here I want to get all properties of Employee Class. How can I?- Перемещено Esther FanMicrosoft Employee, Moderator 23 апреля 2012 г. 1:07 (From:Visual Studio Class Designer)
Все ответы
-
12 марта 2012 г. 8:12
Hi
You need to NEW a instance of this class and use Instace.propertyname to get the property.
by the way, C# in general forum can be more suitable for your issue: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/threads
No code, No fact.

