假设我有3个整数都声明为
int Y = 0;
int N = 0;
int U = 0;
Run Code Online (Sandbox Code Playgroud)
从那里我从存储过程中获取2个值(一个字符串和一个整数).
该字符串返回Y,N,U
整数返回参加人数.
string test = dr["ATTEND_CDE"].ToString();
int test2 = int.Parse(dr["COUNT"].ToString());
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法来分配相应的整数除以下计数:
if (test == "Y")
{
Y = test2;
}
else if (test == "N")
{
N = test2;
}
else if (test == "U")
{
U = test2;
}
Run Code Online (Sandbox Code Playgroud) c# ×1