代码中的疑问可以用注释来解释 [英] doubt in code can u explain with comments
问题描述
你可以逐行解释我的评论plz
can u explain me line by line with comments plz
List<employeeinfo> eList = new List<employeeinfo>();
EmployeeInfo objEmp = null;
DataSet ds = new DataSet();
ds.ReadXml(xmlConString);
if (ds.Tables.Count != 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
objEmp = new EmployeeInfo();
objEmp.ID = Convert.ToInt64(ds.Tables[0].Rows[i]["ID"]);
objEmp.EmployeeCode = Convert.ToString(ds.Tables[0].Rows[i]["EmployeeCode"]);
objEmp.EmployeeName = Convert.ToString(ds.Tables[0].Rows[i]["EmployeeName"]);
objEmp.DepartmentId = Convert.ToInt32(ds.Tables[0].Rows[i]["DepartmentId"]);
objEmp.DepartmentName = Convert.ToString(ds.Tables[0].Rows[i]["DepartmentName"]);
objEmp.EmployeeGroup = Convert.ToString(ds.Tables[0].Rows[i]["EmployeeGroup"]);
objEmp.Email = Convert.ToString(ds.Tables[0].Rows[i]["Email"]);
objEmp.isActive = Convert.ToBoolean(ds.Tables[0].Rows[i]["isActive"]);
eList.Add(objEmp);
推荐答案
没有。您是否知道逐行解释代码的工作量是多少?
每一行都需要一段解释!例如:
No. Do you have any idea how much work explaining code line by line is?
Every single line needs a paragraph of explanation! For example:
int next = r.Next();
创建一个名为next的新变量,它可以包含一个整数值。从先前声明的Random实例r,调用Next方法获取一个新的随机数,并将其分配给next变量。
可以你想象我们需要多长时间才能解释一个像你的例子一样的非常短的代码片段,一行一行?
不会发生这种情况。如果您有特定问题,请询问有关它的问题。但首先考虑一下 - 您是否希望坐下45分钟并且没有充分的理由输入逐行描述?
Create a new variable called "next" which can hold a integer value. From the previously declared Random instance "r", call the "Next" method to get a new random number, and assign it to the "next" variable.
Can you imagine how long it would take us to explain even a very short code fragment like your example, line by line?
No. It is not going to happen. If you have a specific problem, then ask a question about it. But think first - would you want to sit down for 45 minutes and type up a line-by-line description for no good reason?
这篇关于代码中的疑问可以用注释来解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!