ParameterBuilder.SetConstant(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the default value of the parameter.
public:
virtual void SetConstant(System::Object ^ defaultValue);
public virtual void SetConstant (object? defaultValue);
public virtual void SetConstant (object defaultValue);
abstract member SetConstant : obj -> unit
override this.SetConstant : obj -> unit
Public Overridable Sub SetConstant (defaultValue As Object)
Parameters
- defaultValue
- Object
The default value of this parameter.
Exceptions
The parameter is not one of the supported types.
-or-
The type of defaultValue
does not match the type of the parameter.
-or-
The parameter is of type Object or other reference type, defaultValue
is not null
, and the value cannot be assigned to the reference type.
Remarks
defaultValue
is restricted to the following types: Boolean
, SByte
, Int16
, Int32
, Int64
, Byte
, UInt16
, UInt32
, UInt64
, Single
, Double
, DateTime
, Char
, String
, and Enum
. If the parameter type is a reference type, CLS compliance requires defaultValue
to be null
. However, starting with the .NET Framework 4, defaultValue
can be non-null for a reference type as long as the value can be assigned to that reference type. For example, an Int32
value can be assigned to a parameter of type Object. This is not CLS-compliant, but it can be useful in interop scenarios.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기