private static JsonPropertyInfo[] WeatherForecastWithPOCOsPropInitFunc(JsonSerializerContext context)
        {
            JsonContext           jsonContext = (JsonContext)context;
            JsonSerializerOptions options     = context.Options;

            JsonPropertyInfo[] properties = new JsonPropertyInfo[7];

            properties[0] = JsonMetadataServices.CreatePropertyInfo(
                options,
                isProperty: true,
                declaringType: typeof(WeatherForecastWithPOCOs),
                propertyTypeInfo: jsonContext.DateTimeOffset,
                converter: null,
                getter: static (obj) => { return(((WeatherForecastWithPOCOs)obj).Date); },
                setter: static (obj, value) => { ((WeatherForecastWithPOCOs)obj).Date = value; },
                ignoreCondition: default,
Esempio n. 2
0
        private static JsonPropertyInfo[] HighLowTempsPropInitFunc(JsonSerializerContext context)
        {
            JsonContext           jsonContext = (JsonContext)context;
            JsonSerializerOptions options     = context.Options;

            JsonPropertyInfo[] properties = new JsonPropertyInfo[2];

            properties[0] = JsonMetadataServices.CreatePropertyInfo <int>(
                options,
                isProperty: true,
                declaringType: typeof(HighLowTemps),
                propertyTypeInfo: jsonContext.Int32,
                converter: null,
                getter: static (obj) => { return(((HighLowTemps)obj).High); },
                setter: static (obj, value) => { ((HighLowTemps)obj).High = value; },
                ignoreCondition: default,