public User Clone() { var clone = new User { Id = Id.Clone() as string, Avatar = Avatar.Clone() as string, Name = Name.Clone() as string, Email = Email.Clone() as string, Phone = Phone.Clone() as string, OtherConnectionField = OtherConnectionField.Clone() as string, Agreement = Agreement, Password = Password.Clone() as string, Username = Username.Clone() as string, UILang = UILang.Clone() as string, Token = Token.Clone() as string, WorkedProjects = new Dictionary <string, string>(), ProjectRoles = new Dictionary <string, string>() }; foreach (var projId in WorkedProjects.Keys) { clone.WorkedProjects.Add(projId.Clone() as string, WorkedProjects[projId].Clone() as string); } foreach (var projId in ProjectRoles.Keys) { clone.ProjectRoles.Add(projId.Clone() as string, ProjectRoles[projId].Clone() as string); } return(clone); }
public User Clone() { var clone = new User { Id = (string)Id.Clone(), Avatar = (string)Avatar.Clone(), HasAvatar = HasAvatar, Name = (string)Name.Clone(), Email = (string)Email.Clone(), Phone = (string)Phone.Clone(), OtherConnectionField = (string)OtherConnectionField.Clone(), Agreement = Agreement, Password = (string)Password.Clone(), Username = (string)Username.Clone(), UILang = (string)UILang.Clone(), Token = (string)Token.Clone(), WorkedProjects = new Dictionary <string, string>(), ProjectRoles = new Dictionary <string, string>() }; foreach (var projId in WorkedProjects.Keys) { clone.WorkedProjects.Add((string)projId.Clone(), (string)WorkedProjects[projId].Clone()); } foreach (var projId in ProjectRoles.Keys) { clone.ProjectRoles.Add((string)projId.Clone(), (string)ProjectRoles[projId].Clone()); } return(clone); }