Improve detection of Record types (#24409)
This commit is contained in:
parent
fd9f17ddf9
commit
17687f538c
|
|
@ -143,7 +143,8 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
static bool IsRecordType(Type type)
|
static bool IsRecordType(Type type)
|
||||||
{
|
{
|
||||||
// Based on the state of the art as described in https://github.com/dotnet/roslyn/issues/45777
|
// Based on the state of the art as described in https://github.com/dotnet/roslyn/issues/45777
|
||||||
var cloneMethod = type.GetMethod("<>Clone", BindingFlags.Public | BindingFlags.Instance);
|
var cloneMethod = type.GetMethod("<Clone>$", BindingFlags.Public | BindingFlags.Instance) ??
|
||||||
|
type.GetMethod("<>Clone", BindingFlags.Public | BindingFlags.Instance);
|
||||||
return cloneMethod != null && cloneMethod.ReturnType == type;
|
return cloneMethod != null && cloneMethod.ReturnType == type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue