Bilješka
Pristup ovoj stranici zahtijeva provjeru vjerodostojnosti. Možete pokušati da se prijavite ili promijenite direktorije.
Pristup ovoj stranici zahtijeva provjeru vjerodostojnosti. Možete pokušati promijeniti direktorije.
The type 'type1' cannot be used as type parameter 'name' in the generic type or method 'name'. There is no boxing conversion or type parameter conversion from 'type1' to 'type2'.
When a generic type uses a type parameter that is constrained, the new class must also satisfy those same constraints.
- In the example that follows, add
where T : ClassConstraint
to classB
.
The following code generates CS0314:
// cs0314.cs
// Compile with: /target:library
public class ClassConstraint { }
public class A<T> where T : ClassConstraint
{ }
public class B<T> : A<T> //CS0314
{ }
// Try using this instead.
public class C<T> : A<T> where T : ClassConstraint
{ }
.NET povratne informacije
.NET je projekat otvorenog koda. Odaberite vezu za pružanje povratnih informacija: