我有一个Payment_Type
有两个字段id
和value
.
public class Payment_Type
{
public int id { get; set; }
public string value { get; set; }
public Payment_Type(int p, string p_2)
{
this.id = p;
this.value = p_2;
}
public static Payment_Type[] PaymentTypeList()
{
Payment_Type[] pay = new Payment_Type[4];
pay[0] = new Payment_Type(1, "Cheque");
pay[1] = new Payment_Type(2, "Demand Draft");
pay[2] = new Payment_Type(3, "Cash");
pay[3] = new Payment_Type(4, "Other");
return pay;
}
}
我想要2。我尝试value
了id
以下代码,但它不起作用。
Byte Payment_Type_Id = 2
string val = Payment_Type.PaymentTypeList().GetValue(Payment_Type_Id).ToString();
它给了我作为Payment_Type 类的命名空间的结果,即CRMEvent.Models.CRM.BLogic.Payment_Type
。
帮帮我,我不知道它有什么问题。我对MVC没有深入的了解。