diff --git a/DicomTypeTranslation/DicomTypeTranslation.csproj b/DicomTypeTranslation/DicomTypeTranslation.csproj index 03cd13e..cb9ea9d 100644 --- a/DicomTypeTranslation/DicomTypeTranslation.csproj +++ b/DicomTypeTranslation/DicomTypeTranslation.csproj @@ -35,6 +35,6 @@ - + diff --git a/DicomTypeTranslation/TableCreation/SystemTypeTypeConverter.cs b/DicomTypeTranslation/TableCreation/SystemTypeTypeConverter.cs index 281fcea..880c9ad 100644 --- a/DicomTypeTranslation/TableCreation/SystemTypeTypeConverter.cs +++ b/DicomTypeTranslation/TableCreation/SystemTypeTypeConverter.cs @@ -5,22 +5,22 @@ namespace DicomTypeTranslation.TableCreation; -internal class SystemTypeTypeConverter : IYamlTypeConverter +internal sealed class SystemTypeTypeConverter : IYamlTypeConverter { public bool Accepts(Type type) { return typeof(Type).IsAssignableFrom(type); } - public object ReadYaml(IParser parser, Type type) + public object ReadYaml(IParser parser, Type type, ObjectDeserializer _) { var scalar = parser.Consume(); return Type.GetType(scalar.Value); } - public void WriteYaml(IEmitter emitter, object value, Type type) + public void WriteYaml(IEmitter emitter, object value, Type _1, ObjectSerializer _2) { - var typeName = ((Type)value).FullName; + var typeName = (value as Type)?.FullName ?? throw new ArgumentException("SytemTypeTypeConverter.WriteYaml called with non-Type argument",nameof(value)); emitter.Emit(new Scalar(typeName)); } } \ No newline at end of file