I would like to us the value of a String i have created and write out the value in my code. In this example i don't know the value of the String "attribut":
public void EditUser(Int32 user_no, String attribut, String change)
{
tmpUser = GetUser(user_no);
if (attribut.Equals("username"))
{
tmpUser.username = change;
}
else if (attribut.Equals("mail"))
{
tmpUser.mail = change;
}
else
{
tmpUser.password = change;
}
}
I know I can't do it like this:
tmpUser.attribut = change;
Is there a way do this and avoid using the if else statements.