public MetadataDictionaryAdaptor(Metadata metadata, Inspector parentDrawer) : base(metadata, parentDrawer) { this.metadata = metadata; metadata.valueChanged += (previousValue) => { if (!metadata.isDictionary) { throw new InvalidOperationException("Metadata for dictionary adaptor is not a dictionary: " + metadata); } if (metadata.value == null) { metadata.value = ConstructDictionary(); } newKeyMetadata?.Unlink(); newValueMetadata?.Unlink(); newKeyMetadata = metadata.Object("newKey", ConstructKey(), metadata.dictionaryKeyType); newValueMetadata = metadata.Object("newValue", ConstructValue(), metadata.dictionaryValueType); }; }
public NullableInspector(Metadata metadata) : base(metadata) { var underlyingType = Nullable.GetUnderlyingType(metadata.definedType); underlyingMetadata = metadata.Object("__underlying", metadata.value ?? Activator.CreateInstance(underlyingType), underlyingType); }