我有一堂课AuthUser
public class AuthUser
{
public int UserID { get; set; }
public string UserNo { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
}
我已将课程转换为string
.
AuthUser au = new AuthUser();
//dtUserDetails is a data table
if (dtUserDetails.Rows.Count > 0)
{
DataRow DR = dtUserDetails.Rows[0];
au.UserID = Convert.ToInt32(DR["UserID"].ToString());
au.UserNo = DR["UserNo"].ToString();
au.UserName = DR["UserName"].ToString();
au.Password = DR["Password"].ToString();
}
string userData = au.ToString();
现在我需要将上面的UserData
字符串转换回对象类型来检索数据。我怎样才能做到这一点?