分割字符串

if (libUser.Items.Count > 0)
{
string _sUserList = string.Empty;
foreach (object o in libUser.Items)
{
_sUserList += o.ToString().Split('|').GetValue(1).ToString() + ",";
}
_sUserList = _sUserList.TrimEnd(',');
dgvEmployees.DataSource = oWork.GetDataByEmployeeID(_sUserList).Tables[0];
}
else
{
dgvEmployees.DataSource = oWork.GetDataByEmployeeID(string.Empty).Tables[0];

}

原文地址:https://www.cnblogs.com/markli/p/3412085.html