© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•17mo ago•
26 replies
Ownera

Just learned generics...

I just learned generics and have a problem that i tried googling but still couldnt solve.

I have a person class

internal class Person<T> where T : Person<T>
    {
        public T Name { get; set; }
        public T Pass { get; set; }

        

    }
internal class Person<T> where T : Person<T>
    {
        public T Name { get; set; }
        public T Pass { get; set; }

        

    }


internal class User : Person // this is the error.At person, CS0305
    {

        public string Nameu { get; set; }

        public string Passu { get; set; }

    }
internal class User : Person // this is the error.At person, CS0305
    {

        public string Nameu { get; set; }

        public string Passu { get; set; }

    }


And a user class that i want to inherit the Person class.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Generics
C#CC# / help
3y ago
❔ Generics
C#CC# / help
3y ago
Generics question
C#CC# / help
2y ago
Help with Generics
C#CC# / help
2y ago