Class StdLibMemberAttribute
Declares what a standard-library member looks like to VBA source, where its C# signature cannot say so on its own.
[AttributeUsage(AttributeTargets.Method)]
public sealed class StdLibMemberAttribute : Attribute
- Inheritance
-
StdLibMemberAttribute
- Inherited Members
Remarks
Everything this attribute carries has a default drawn from the signature, so it is needed only
where the signature and the VBA declaration genuinely diverge - a name C# cannot spell, an
accessor kind a signature cannot express, or a return type that is a class or an enumeration
rather than an intrinsic. A member without it is a Sub or Function of the same name.
Constructors
StdLibMemberAttribute(string?)
Declares what a standard-library member looks like to VBA source, where its C# signature cannot say so on its own.
public StdLibMemberAttribute(string? name = null)
Parameters
namestringThe member's name in VBA source, when it differs from the name of the method declaring it.
Remarks
Everything this attribute carries has a default drawn from the signature, so it is needed only
where the signature and the VBA declaration genuinely diverge - a name C# cannot spell, an
accessor kind a signature cannot express, or a return type that is a class or an enumeration
rather than an intrinsic. A member without it is a Sub or Function of the same name.
Fields
NoUserMemId
What UserMemId is when the member states none.
public const int NoUserMemId = -2147483648
Field Value
Properties
IsHidden
Whether the member is hidden: it resolves like any other, and is left out of a completion list.
public bool IsHidden { get; init; }
Property Value
Kind
Which kind of member this is, for the kinds a signature cannot express. Procedure by default.
public StdLibMemberKind Kind { get; init; }
Property Value
Name
The member's name in VBA source, or null to use the name of the method declaring it.
public string? Name { get; }
Property Value
Remarks
Needed where a VBA name is not a C# identifier, or where two members differ only in ways C#
overload resolution cannot see. Both happen at once in the $-suffixed pairs
(MS-VBAL §6.1.2.3.1): Hex and Hex$ take the same argument and
differ only in return type, so they are two differently-named methods, one of which says here
what it is really called.
ReturnType
The type VBA source sees this member return, when that is a standard-library class or enumeration rather than an intrinsic type.
public Type? ReturnType { get; init; }
Property Value
Remarks
Either an interface carrying StdLibClassAttribute - the class whose instance is
returned - or an enumeration carrying StdLibEnumAttribute. The signature's own
RuntimeSemanticsEvaluationResult<TValue> still states the value an
implementation produces, which for these is a
VBObjectValue and a
VBLongValue respectively; this states what the declared
type is called. null - the default - takes the declared type from the signature.
UserMemId
The member's VB_UserMemId: WellKnownDispIds.Value (0) for the default member of its class,
WellKnownDispIds.NewEnum (-4) for its enumeration member. NoUserMemId - the default - for neither.
public int UserMemId { get; init; }
Property Value
Remarks
The attribute of a workspace class module says the same thing in source (Attribute Item.VB_UserMemId = 0), and is what the symbols of that
are stamped with: this is the library's own way to say it, so that a Collection is found enumerable the way a class of the workspace is.