Question

When I was writing documentation for a method taking a parameter of type MethodAttributes (.NET), I had trouble to refer to the concept of a member being either a static or an instance member.

Is there a good word or phrase to name the concept of static/instance affiliation without writing it out (like I did here)?

Edit:
The API is the following. It allows a user to add a method to something we call a mutable type. Very similiar to Reflection.Emit's TypeBuilder.DefineMethod method.

public MutableMethodInfo AddMethod (
    string name,
    MethodAttributes attributes,
    Type returnType,
    IEnumerable<ParameterDeclaration> parameterDeclarations,
    Func<MethodBodyCreationContext, Expression> bodyProvider
);
Was it helpful?

Solution

I don't believe there is a specific word that captures the quality of a method either belonging to a class or an instance. For a start, different languages use very different words for these things anyway. Java and C# use static or nothing, as does C++. Objective-C marks methods with '-' or '+', but people usually refer to class or instance methods. Javascript of course doesn't really have classes so is different again, etc.

You're best bet in code would be something like isStatic or isClassMethod. Perfectly readable and should leave no doubt as to what it means. In documentation it would probably be best to go with longhand, ie "class or instance method" or "instance or static method".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top