public static FriendBaseBO Parse(SqlString sqlStr) { if (sqlStr.IsNull) { return(null); } else { int strCnt = 0; int count = 0; FriendBaseBO friendBase = new FriendBaseBO(); string str = Convert.ToString(sqlStr); string[] strSplit = null; strSplit = str.Split(new char[] { ';' }); friendBase.FirstName = strSplit[strCnt] == null ? "" : strSplit[strCnt]; strCnt++; friendBase.LastName = strSplit[strCnt] == null ? "" : strSplit[strCnt]; strCnt++; friendBase.Email = strSplit[strCnt] == null ? "" : strSplit[strCnt]; strCnt++; friendBase.Gender = (EGender)Convert.ToInt32(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; return(friendBase); } }
// Exceptions: // System.ArgumentException: // Other object is null // The argument to compare is not a FriendBase // Refering object (this) is null public int CompareTo(object other) { if (other == null) { throw new System.ArgumentException("Other object is null", "other"); } FriendBaseBO friendBase = other as FriendBaseBO; if (friendBase == null) { throw new System.ArgumentException("The argument to compare is not a friendBase", "other"); } return(this.ToString().CompareTo(friendBase.ToString())); }