Exemplo n.º 1
0
        private static JsonPropertyInfo GetMissingProperty()
        {
            JsonPropertyInfo info = new JsonPropertyInfoNotNullable <object, object, object, object>();

            info.IsPropertyPolicy  = false;
            info.ShouldDeserialize = false;
            info.ShouldSerialize   = false;
            return(info);
        }
Exemplo n.º 2
0
        // Create a property that is ignored at run-time. It uses the same type (typeof(sbyte)) to help
        // prevent issues with unsupported types and helps ensure we don't accidently (de)serialize it.
        public static JsonPropertyInfo CreateIgnoredPropertyPlaceholder(PropertyInfo propertyInfo, JsonSerializerOptions options)
        {
            JsonPropertyInfo jsonPropertyInfo = new JsonPropertyInfoNotNullable <sbyte, sbyte, sbyte, sbyte>();

            jsonPropertyInfo.Options      = options;
            jsonPropertyInfo.PropertyInfo = propertyInfo;
            jsonPropertyInfo.DeterminePropertyName();

            Debug.Assert(!jsonPropertyInfo.ShouldDeserialize);
            Debug.Assert(!jsonPropertyInfo.ShouldSerialize);

            return(jsonPropertyInfo);
        }