I try to use first answer of Checking for alternate keys with XNA IsKeyDown but the compiler shows me Extension method must be defined in a non-generic static class. How can I fix this issue?
Questions on Game Development Stack Exchange are expected to relate to game development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.
The solution proposed by the given answer (http://gamedev.stackexchange.com/a/37637/18568) uses the C# language concept of Extension Methods. These are described in more detail here. What you are doing is effectively 'tacking on' another method to a pre-made class definition that you are unable to modify directly, due to it being supplied as part of a library, or in another form or situation such that the original class should not be edited directly.
To answer your question simply, the snippet of the
Following this, you need to make sure that you specify