private void DeserializeSharedResource(IntermediateReader input, object parentInstance) { if (this.valueSetter == null) { throw new InvalidOperationException(Resources.ReadOnlySharedResource); } Action <object> fixup = delegate(object value) { if (!this.typeSerializer.IsTargetType(value)) { throw input.CreateInvalidContentException(Resources.WrongSharedResourceType, new object[] { this.typeSerializer.TargetType, value.GetType() }); } this.valueSetter(parentInstance, value); }; input.ReadSharedResource <object>(this.formatAttribute, fixup); }