0
I’m trying to learn a little c#, and the microsoft website encourages me to use vscode for programming on linux, but I’m having a problem with Stackoverflowexception and I can’t understand why (the code does not run any loop visually infinite).
Follow the main code:
static void Main(string[] args) {
UserInfo info = new UserInfo("user","password");
Console.WriteLine(info.user);
}
And the code of the Userinfo class
public class UserInfo {
public string user {
get {
return this.user;
}
set {
this.user = user;
}
}
public string password {
get {
return this.cryptPassword(this.password);
}
set {
this.password = password;
}
}
public UserInfo(string user, string password) {
this.user = user;
this.password = password;
}
private string cryptPassword(string password){
string[] cryptArray = password.Split("");
string[] reverseArray = new string[cryptArray.Length];
for(int index = 0; index < cryptArray.Length; index++){
reverseArray[index] = cryptArray[cryptArray.Length - index];
}
string crypt = string.Join("",cryptArray);
return $"HASH{crypt}000";
}
}
And all the files are within the same namespace.
So what am I doing wrong?
https://answall.com/q/101691/101
– Maniero