public static NewNullIsProhibited ( string memberName ) : |
||
memberName | string | The name of the member. |
Результат |
private static void VerifyNilImplication(Type type, IEnumerable <SerializingMember> entries) { foreach (var serializingMember in entries) { if (serializingMember.Contract.NilImplication == NilImplication.Null) { var itemType = serializingMember.Member.GetMemberValueType(); if (itemType != typeof(MessagePackObject) && itemType.GetIsValueType() && Nullable.GetUnderlyingType(itemType) == null) { throw SerializationExceptions.NewValueTypeCannotBeNull(serializingMember.Member.ToString(), itemType, type); } bool isReadOnly; FieldInfo asField; PropertyInfo asProperty; if ((asField = serializingMember.Member as FieldInfo) != null) { isReadOnly = asField.IsInitOnly; } else { asProperty = serializingMember.Member as PropertyInfo; // 20150616 applibot modify //#if DEBUG && !UNITY_IPHONE && !UNITY_ANDROID #if DEBUG && !UNITY_IPHONE && !UNITY_ANDROID && !UNITY Contract.Assert(asProperty != null, serializingMember.Member.ToString()); #endif isReadOnly = asProperty.GetSetMethod() == null; } if (isReadOnly) { throw SerializationExceptions.NewNullIsProhibited(serializingMember.Member.ToString()); } } } }