Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Generics Problem
Message
Information générale
Forum:
ASP.NET
Catégorie:
Client-side développement
Divers
Thread ID:
01472084
Message ID:
01472135
Vues:
45
>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"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform