- Регистрация
- 01.02.2012
- Сообщения
- 4 812
- Благодарностей
- 1 187
- Баллы
- 113
Why I'm sometimes getting error from this code:
Error message: Object reference not set to an instance of an object.
C#:
var r = new Random();
int rand = r.Next(1, 12);
System.Threading.Thread.Sleep(1000);
if(rand == 1) project.Profile.Login = project.Profile.Surname + project.Profile.Age;
else if(rand == 2) project.Profile.Login = project.Profile.Login;
else if(rand == 3) project.Profile.Login = project.Profile.Name + project.Profile.Age + project.Profile.Surname;
else if(rand == 4) project.Profile.Login = project.Profile.Name + "." + project.Profile.Surname;
else if(rand == 5) project.Profile.Login = project.Profile.Name + project.Profile.Surname + project.Profile.Age;
else if(rand == 6) project.Profile.Login = project.Profile.CurrentRegion + project.Profile.Age;
else if(rand == 7) project.Profile.Login = project.Profile.Interest + project.Profile.Age;
else if(rand == 8) project.Profile.Login = project.Profile.NickName;
else if(rand == 9) project.Profile.Login = project.Profile.Name + project.Profile.ZipCode;
else if(rand == 10) project.Profile.Login = project.Profile.Name + project.Profile.BornYear;
else if(rand == 11) project.Profile.Login = project.Profile.Surname + project.Profile.BornYear;