Class StdLibDefaultAttribute
States the default value of an optional standard-library parameter, which its C# signature cannot carry.
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class StdLibDefaultAttribute : Attribute
- Inheritance
-
StdLibDefaultAttribute
- Inherited Members
Remarks
A parameter is declared as a VBTypedValue, and C# gives a parameter of a class type no default
but null (= default), which states no <default-value> clause at all: an omitted argument then takes the
declared type's own default value. A member whose specification declares one, such as Optional Limit As Long = -1
(MS-VBAL §6.1.2.11.1.35), states it here, and the parameter's symbol carries it as the constant expression it is, so
that an omitted argument takes it - and the member is told -1, which it cannot tell apart from an explicit -1, rather
than 0, which it could not tell apart from an explicit 0.
👉 An enumeration's default needs none: an enumeration constant is a C# default, and is stated as one.
Constructors
StdLibDefaultAttribute(object)
States the default value of an optional standard-library parameter, which its C# signature cannot carry.
public StdLibDefaultAttribute(object value)
Parameters
valueobjectThe default value, as the C# value of the declared type: an int for a
Longor anInteger, a bool for aBoolean, a string for aString.
Remarks
A parameter is declared as a VBTypedValue, and C# gives a parameter of a class type no default
but null (= default), which states no <default-value> clause at all: an omitted argument then takes the
declared type's own default value. A member whose specification declares one, such as Optional Limit As Long = -1
(MS-VBAL §6.1.2.11.1.35), states it here, and the parameter's symbol carries it as the constant expression it is, so
that an omitted argument takes it - and the member is told -1, which it cannot tell apart from an explicit -1, rather
than 0, which it could not tell apart from an explicit 0.
👉 An enumeration's default needs none: an enumeration constant is a C# default, and is stated as one.
Properties
Value
The default value, as the C# value of the parameter's declared type.
public object Value { get; }