Calling fieldBuilder.SetValue(...)
is currently not supported according to the documentation. The documentation advices:
As a workaround, retrieve the FieldInfo by reflecting on the finished type and call SetValue to set the value of the field.
This was possible in .NET Framework for static init-only fields, however this is no longer supported in .NET Core.
How to initialize static init-only field of dynamic type in .NET Core?
Aucun commentaire:
Enregistrer un commentaire