Reflection: Allow ParameterBuilder.SetConstant(nonNullValue) for nullable enum parame...
authorstakx <stakx@eml.cc>
Mon, 14 May 2018 14:20:53 +0000 (16:20 +0200)
committerAtsushi Kanamori <AtsushiKan@users.noreply.github.com>
Mon, 14 May 2018 14:20:53 +0000 (07:20 -0700)
commitd9736d2c4dcbc8bbcde026bdce20812f67596d5b
treefe0e2c0ea6ab4817d5ef1fcb68fda0c9647e323d
parent32fbde69864fa31087abbdd33a0e646b98436bdc
Reflection: Allow ParameterBuilder.SetConstant(nonNullValue) for nullable enum parameters (dotnet/coreclr#17977)

* ParameterBuilder.SetConstant(nonNull) for TEnum?

This change makes it possible to use `ParameterBuilder.SetConstant`
to set a non-null default value for parameters having a nullable enum
type.

* ParameterInfo.DefaultValue for TEnum?

Add a note to `MdConstant.GetValue` (which sits behind `ParameterInfo.
[Raw]DefaultValue`) explaining why changing its behavior to mirror the
change in `TypeBuilder.SetConstantValue` would be a breaking change.

Commit migrated from https://github.com/dotnet/coreclr/commit/f1c47fa7d2cdf29c5d0d1d7c89855e0d0ee5518a
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/MdConstant.cs