Difficulty: Easy
Correct Answer: Static functions are invoked using class.
Explanation:
Introduction / Context:
Static members belong to the type itself rather than to any particular instance. Understanding how to call them and what they can access is a core C# concept.
Given Data / Assumptions:
Concept / Approach:
Static methods are called on the type (for example, Math.Abs(…)
), not on an instance. A static method cannot access instance fields or properties directly because it lacks a this
reference. Static methods are defined within class (or struct) scope just like instance methods.
Step-by-Step Solution:
TypeName.StaticMethod()
.
Verification / Alternative check:
Attempt to reference an instance field from a static method; the compiler flags an error due to missing instance context.
Why Other Options Are Wrong:
Common Pitfalls:
Creating an instance only to call a static method — unnecessary and misleading.
Final Answer:
Static functions are invoked using class.
Discussion & Comments