I'm trying to learn a bit of C #, and the microsoft site encourages me to use vscode to program in linux, however I'm having a StackOverflowException problem and I can not understand the reason (the code does not run any visually infinite loops) .
Follow the main code:
static void Main(string[] args) {
UserInfo info = new UserInfo("user","password");
Console.WriteLine(info.user);
}
And the code for 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?