So essentially, if you create a single case DU then the type name is the actual type name. But if you create multiple case DU then the type name is one of the case names....
Repro steps
type Events = CreatedEvent of string | DeletedEvent of string
type SuperEvents = AllEvents of Events
let cr = CreatedEvent "id"
let sucr = AllEvents cr
sucr.GetType().Name // val it: string = "SuperEvents"
cr.GetType().Name // val it: string = "CreatedEvent"
Expected behavior
I would expect sucr.GetType().Name === "AllEvents"
Actual behavior
sucr.GetType().Name === "SuperEvents"
Related information
Provide any related information (optional):
- Operating system : Windows 10
- .NET Runtime kind (.NET Core, .NET Framework, Mono) : .NET 6.0.100 :: F# 6.0.1
- Editing Tools (e.g. Visual Studio Version, Visual Studio) : dotnet fsi