コード例 #1
0
        internal static DiskSku DeserializeDiskSku(JsonElement element)
        {
            DiskStorageAccountTypes?name = default;
            string tier = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = new DiskStorageAccountTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("tier"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    tier = property.Value.GetString();
                    continue;
                }
            }
            return(new DiskSku(name, tier));
        }
コード例 #2
0
        internal static DiskSku DeserializeDiskSku(JsonElement element)
        {
            Optional <DiskStorageAccountTypes> name = default;
            Optional <string> tier = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = new DiskStorageAccountTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("tier"))
                {
                    tier = property.Value.GetString();
                    continue;
                }
            }
            return(new DiskSku(Optional.ToNullable(name), tier.Value));
        }