I’ve a problem in C# with a generic class:
class Hop<T>
{
static string x;
}
Can I initialize x for all the instance of Hop?
Something like Hop.x = "test"; doesn’t work for instance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The problem is, there is no
Hoptype, there is aHop<T>generic type. How about:But the problem you still have, is this:
The static field is for the
Hoptype, not theHop<T>type.