Пример #1
0
 private void AddUserToDatabase(UserDatabase database, string content)
 {
     //元数据content = username|password|nickname|gender|age|email|
     //可能的错误:信息中带有“|”
     string[] tokens = content.Split(new char[] { '|' });
     ServerUser newUser = new ServerUser()
     {
         UserName = tokens[0],
         Password = tokens[1],
         NickName = tokens[2],
         Gender = (GenderOption)Enum.Parse(typeof(GenderOption), tokens[3]),
         Age = int.Parse(tokens[4]),
         Email = tokens[5]
     };
     database.AddUser(newUser);
 }