I want to write
AspNetForums.Components.User MyUser = AspNetForums.Users.GetUser(UserID,true);
this = (MyNamespace.User) MyUser;
but it says <this> is read only.
Is there a way to do this without having to write everything out like this?
Unless you create a SetProps() method that you pass these properties in, and this function does the assignment. You have to do the property assignment.
AspNetForums.Components.User MyUser = AspNetForums.Users.GetUser(UserID,true);
this.YahooIM = MyUser.YahooIM;
this.WebLog = MyUser.WebLog;
this.WebAddress = MyUser.WebAddress;
this.Username = MyUser.Username;
Brian
Thanks. Man, this object has like 40 properties.
Yeah, that happens, however, a more dynamic solution (like maybe reflection) could give you performance problems, whereas a little bit of coding will give you less headaches in the long run.
Brian
0 comments:
Post a Comment