我已经超出了VB.Net的方式太长了,我有一个需要转换为VB.Net的C#自定义类,想知道它们之间的主要区别。在C#中的某些东西,我似乎无法在Vb.Net做类,如使用:在VB.net公共类名或公共[类名(数据表DT)C#和VB.Net自定义类之间的区别
我班如下所示:
public class subcontractor
{
public int organization_id { get; set; }
public int subcontractor_id { get; set; }
public int project_id { get; set; }
public List<evaluationpoint> points { get; set; }
public subcontractor() { }
public subcontractor(DataTable dt)
{
organization_id = Convert.ToInt32(dt.Rows[0]["organization_id"].ToString());
subcontractor_id = Convert.ToInt32(dt.Rows[0]["subcontractor_id"].ToString());
project_id = Convert.ToInt32(dt.Rows[0]["project_id"].ToString());
points = new List<evaluationpoint>();
foreach (DataRow dr in dt.Rows)
{ points.Add(new evaluationpoint(dr)); }
}
public class evaluationpoint
{
public int category_id { get; set; }
public int eval_id { get; set; }
public int rating { get; set; }
public evaluationpoint() { }
public evaluationpoint(DataRow dr)
{
category_id = Convert.ToInt32(dr["category_id"].ToString());
eval_id = Convert.ToInt32(dr["eval_id"].ToString());
rating = Convert.ToInt32(dr["rating"].ToString());
}
}
}
有什么区别
自从我涉足VB以来,它已经很长时间了,如果不够用,这些东西就会从内存中滑落。我知道语法有很大的不同,只是忘记了如何在自己内部安装一个新类,谢谢 – mattgcon
'as Integer'甚至:) – Guffa
@Guffa:我不经常使用VB,因为你可以告诉:)谢谢,我修复了它 –