private void VerifyValue(object value, string valName) { if (value == null) { if (!FieldType.AllowNull()) { throw new InvalidOperationException($"The {valName} for {Name} cannot be null. Expecting {FieldType.FullName}"); } return; } if (!FieldType.IsAssignableFrom(value.GetType())) { throw new InvalidOperationException($"The {valName} for {Name} is not of the correct type. The type is {value.GetType().FullName}, expecting {FieldType.FullName}."); } }