Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generics Problem
Message
General information
Forum:
ASP.NET
Category:
Client-side development
Miscellaneous
Thread ID:
01472084
Message ID:
01472135
Views:
43
>I'm trying to write a simple mapping method:
>
>
>
>private D _ConvertUser<S, D>(S Source, D Destionation)
>{
>    D RetVal = default(D);
>
>    if (Source is aspnetUser)
>    {
>        Source = (aspnetUser)Source;
>
>        RetVal = new MyMembershipUser(Source.ProviderName, Source.UserName, Source.ProviderUserKey, Source.Email,
>                                        Source.PasswordQuestion, Source.Comment, Source.IsApproved, Source.IsLockedOut,
>                                        Source.CreationDate, Source.LastLoginDate, Source.LastActivityDate,
>                                        Source.LastPasswordChangedDate, Source.LastLockoutDate, User.IsDomainUser, true);
>
>    }
>    else
>    { 
>    }
>
>    return RetVal;
>}
>
>
>
>It won't compile because the "Source = (aspnetUser)Source;". I get "Cannot convert type 'S' to 'aspnetUser'".
>
>How do I do this?

What were the concrete types used to create the class instance ?
Actually I should also ask 'What concrete types do you envisage will be used in other cases"
Previous
Reply
Map
View

Click here to load this message in the networking platform