• Avalanche.Core
Search Results for

    Show / Hide Table of Contents
    • Avalanche.Accessor
      • Introduction
      • IAccessor
        • IAccessor
        • IListAccessor
        • IMapAccessor
        • IRecordAccessor
        • IContentAccessor
        • IOneOfAccessor
        • IAnyAccessor
      • .Net
        • Introduction
        • IList<T>
        • IDictionary<K,V>
        • FieldInfo
        • OneOfAttribute
        • StructLayoutAttribute
        • Class
      • Protobuf
        • Introduction
      • Articles
        • Dependency Injection
        • AccessorMessages
    • Avalanche.Binding
      • Introduction
    • Avalanche.Configuration
      • Introduction
      • Configuration Binding
      • ConfigurationExtensions
      • MemoryConfiguration
      • PrintTree
      • Saving IOptions
      • Yaml
    • Avalanche.Converter
      • Introduction
      • EnumConverter
      • Func<,>
      • HexConverter
      • PrimitiveConverter
      • StringConverter
    • Avalanche.Core
      • License
    • Avalanche.DataType
      • Introduction
      • DataType
        • IDataType
        • IListType
        • IMapType
        • IRecordType
        • IFieldType
        • IOneOfType
        • IAnyType
        • IStringType
        • IValueType
        • IIntegerType
        • IEnumerationType
        • IRealType
      • .Net
        • Introduction
        • IList<T>
        • IDictionary<K,V>
        • FieldInfo
        • Enum
        • OneOfAttribute
        • StructLayoutAttribute
        • Class
      • Protobuf
        • Introduction
      • Articles
        • DataTypeRequest
        • PrintTree
        • DataTypeMessages
    • Avalanche.Emit
      • Introduction
      • TypeBuilder
      • ConstructorBuilder
      • MethodBuilder
      • PropertyBuilder
      • FieldBuilder
      • Emit
      • Utilities
    • Avalanche.FileSystem
      • Introduction
      • Abstractions
        • IFileSystem
          • IFileSystemBrowse
          • IFileSystemCreateDirectory
          • IFileSystemDelete
          • IFileSystemFileAttribute
          • IFileSystemMount
          • IFileSystemMove
          • IFileSystemObserve
          • IFileSystemOpen
        • IEvent
        • IEntry
        • IOption
        • IToken
      • FileSystem
      • VirtualFileSystem
      • MemoryFileSystem
      • EmbeddedFileSystem
      • HttpFileSystem
      • Decoration
      • IFileProvider
      • Events
      • Utilities
        • Dispose
        • File Scanner
        • Visit Tree
        • File Operation
        • FilterEnumerable
        • PollingFilterWatchToken
    • Avalanche.Identity
      • Introduction
      • Identity
      • IdentityParts
      • IdentityInterner
      • IdentityComparer
      • Print Tree
      • IdentityAccessors
        • Introduction
        • TypeName
    • Avalanche.Localization
      • Introduction
      • Localization
      • LocalizationFile
      • LocalizationFiles
      • LocalizationFileSystem
      • LocalizationFileFormat
      • LocalizationLine
      • LocalizationLines
      • TemplateFormat
      • CultureProvider
      • FallbackCultureProvider
      • ResourceManager
      • LocalizationError
      • Microsoft.Extensions
        • Introduction
        • DependencyInjection
        • FileProvider
        • Logging
        • ITextLocalizer
        • IFileLocalizer
        • Localization
      • Asp.Net
        • Introduction
        • Supplying localization
        • Inject to pages
        • Culture Assigned
        • Minimalistic Api
        • Diagnostics
      • Pluralization
        • Introduction
        • Multiple plural parameters
        • Custom PluralRules
        • Invariant Culture
        • Unit Prefix
        • IPluralRule
        • IPluralNumber
        • IPluralRules
        • CLDRs
        • Unicode.CLDR40
        • Unicode.CLDR41
        • Unicode.CLDR42
      • Articles
        • Alphabet localization
        • Benchmarks
        • Caching
        • Class Library
        • Demo
        • Diagnostics
        • Embedded resources
        • Emplacement
        • File localization
        • Text localization
        • Printing templates
    • Avalanche.Message
      • Introduction
      • IMessage
      • IMessageProvider
      • IMessageDescription
      • IMessageDescriptions
      • MessageLevel
      • Message printing
      • Messages and Exceptions
      • Microsoft.Extensions
        • DependencyInjection
      • Articles
        • Aggregate Messages
        • Localization
        • Logging
        • Validation
    • Avalanche.Options
      • Introduction
      • OptionsExtensions
      • OptionsMonitorCast
    • Avalanche.Service
      • Introduction
      • Service
        • Introduction
        • IService
        • IServiceDisposable
        • IServiceDecoration
        • IServiceCast
        • IServiceObservable
        • IServiceContainer
        • Construction
        • Query
        • CancellationToken
        • CachePolicy
        • Scope
      • Handler
        • Introduction
        • IHandler
        • IHandlerCast
        • IHandlerDecoration
        • IHandlerWithOrder
        • CancellationToken
        • Cyclicity
        • Delegates
        • Invokable
        • ExportAttribute
        • OrderAttribute
        • PrintTree
        • Recursion
      • Query
        • Introduction
        • IQuery
        • IQueryCast
        • IQueryDecoration
      • Entry
        • Introduction
        • IEntry
        • IEntryCast
        • IEntryDecoration
        • IEntryObservable
        • IEntryVisitable
        • EntryState
      • Request
        • Introduction
        • IRequest
        • IRequestFor
        • IRequestToBeCached
        • IRequestToBeDisposed
        • RequestAttribute
        • ContextParameterAttribute
        • Print Tree
      • Dependency Injection
        • Introduction
        • Asp.Net
        • ServiceRequest<T>
        • Decorating a service
        • Handler
        • CachePolicy
        • CancellationToken
        • QueryLogger
        • IHostBuilder
      • Examples
        • NodeCount
        • Expression
        • Mapper
      • Articles
        • Benchmarks
        • Error Handling
        • ServiceMessages
    • Avalanche.StatusCode
      • Introduction
      • HResult
        • Introduction
        • HResult.Facilities
        • BasicMessages
        • RpcMessages
        • DispatchMessages
        • StorageMessages
        • ItfMessages
        • Win32Messages
        • WindowsMessages
        • SspiMessages
        • CertMessages
        • MediaServerMessages
        • SetupApiMessages
        • ScardMessages
        • ComPlusMessages
        • ClrMessages
        • UserModeFilterManagerMessages
        • GraphicsMessages
        • TpmServicesMessages
        • TpmSoftwareMessages
        • PlaMessages
        • FveMessages
        • FwpMessages
        • NdisMessages
        • DltMessages
      • System
        • Introduction
        • AccessControlMessages
        • AggregateMessages
        • AppDomainMessages
        • ArgumentMessages
        • ArgumentNullMessages
        • ArgumentOutOfRangeMessages
        • ArithmeticMessages
        • ArrayMessages
        • AssemblyMessages
        • BadImageFormatMessages
        • CodeContractMessages
        • CodePageMessages
        • CollectionsMessages
        • CompilerServiceMessages
        • CryptographyMessages
        • CultureMessages
        • DiagnosticsMessages
        • EventSourceMessages
        • ExecutionEngineMessages
        • FormatMessages
        • HostProtectionMessages
        • IOMessages
        • IndexOutOfRangeMessages
        • InteropServiceMessages
        • InvalidCastMessages
        • InvalidOperationMessages
        • IsolatedStorageMessages
        • LazyMessages
        • MarshalerMessages
        • MemoryMessages
        • MiscellaneousMessages
        • NotImplementedMessages
        • NotSupportedMessages
        • ObjectDisposedMessages
        • OperationCanceledMessages
        • OverflowMessages
        • PlatformMessages
        • PolicyMessages
        • PrincipalMessages
        • ProgramMessages
        • ReferenceMessages
        • ReflectionMessages
        • RegionMessages
        • RemotingMessages
        • ResourcesMessages
        • SecurityMessages
        • SerializationMessages
        • StackMessages
        • TaskMessages
        • TextMessages
        • ThreadingMessages
        • TimeZoneMessages
        • TypeMessages
        • XmlMessages
      • HttpStatusCode
      • OpcUaStatusCode
    • Avalanche.Template
      • Introduction
      • TemplateFormats
      • ITemplatePrintable
      • ITemplateFormatPrintable
      • ITemplateText
      • ITemplateBreakdown
      • ITemplateFormat
      • ITemplateFormats
      • Extract Arguments
      • Emplacement
    • Avalanche.Tokenizer
      • Introduction
      • IToken
      • ITokenizer
      • Tokenizers
    • Avalanche.Utilities
      • Introduction
      • Collections
        • Tuples
        • StructList
        • ArrayList
        • BijectionMap
        • LocakableDictionary
        • LockableList
        • MapList
        • Pipe
        • RingQueue
        • EnumerableExtensions
        • TupleUtilities
        • ArrayUtilities
      • Comparers
        • IGraphComparer
        • IGraphComparable
        • AlphaNumericComparer
        • EnumerableComparer
        • EnumerableGraphComparer
        • ReferenceComparer
        • KeyValuePairComparer
        • DefaultComparerProvider
        • RecordComparer
      • Cloners
        • ICloner
        • IGraphCloner
        • IGraphCloneable
        • ListCloner
        • DictionaryCloner
        • FieldCloner
        • PassthroughCloner
        • RecordCloner
        • ClonerProvider
      • Dispose
        • IDisposeAttachable
        • IDisposeBelatable
      • Provider
        • Introduction
        • ProviderBase
        • Delegate
        • Pipe
        • Cache
        • ResultCapture
        • AsReadOnly
        • AsService
        • IProviderEvent
      • Record
        • IRecordDescription
        • IFieldDescription
        • IConstructorDescription
        • IConstructionDescription
        • IParameterDescription
        • IRecordProviders
        • RecordDelegates
          • RecordCreate
          • RecordClone
          • RecordCopy
          • IRecordDelegates
        • FieldDelegates
          • FieldRead
          • FieldWrite
          • RecreateWith
          • IFieldDelegates
      • Reflection
        • EnumDescription
      • String
        • IEscaper
        • UnicodeString
        • Hex
      • Miscellaneous
        • IIdGenerator
        • Permutation
        • IReadOnly
        • IUserDataContainer
        • ITreeNode
        • Void
    • Avalanche.Writer
      • Introduction
      • ConstantWriter
      • Context
      • ConvertWriter
      • DefaultConstructor
      • DelegateWriter
      • PassthroughWriter
      • Referer
      • TypeCast
      • Writer
      • WriterPipe
      • WriterMessages

    IMapAccessor

    IAccessor
    └── IMapAccessor
        └── IMapAccessor<Container>
            └── IMapAccessor<Container, Key, Value>
    

    IMapAccessor describes writers that access a map. Map can exist as class, struct, memory-span or stream.

    /// <summary>Map accessor</summary>
    public interface IMapAccessor : IAccessor, IDefaultConstructorAccessor, IConstructorAccessor, IDeconstructorAccessor, IContainerAccessor
    {
        /// <summary></summary>
        Type KeyType { get; set; }
        /// <summary></summary>
        Type ValueType { get; set; }
    
        /// <summary>Get reference to value</summary>
        IWriter Referer { get; set; }
        /// <summary>Remove at key</summary>
        IWriter Remove { get; set; }
        /// <summary>Get value at key.</summary>
        IWriter Get { get; set; }
        /// <summary>Set value at key.</summary>
        IWriter Set { get; set; }
        /// <summary>Clear list.</summary>
        IWriterFrom<Avalanche.Void> Clear { get; set; }
        /// <summary>Count.</summary>
        IWriterTo<long> Count { get; set; }
    }
    

    IMapAccessor<Map> and IMapAccessor<Map, Key, Value> describes accessor for dictionary types.

    /// <summary>Map accessor of <typeparamref name="Map"/>.</summary>
    public interface IMapAccessor<Map, Key, Value> : IMapAccessor<Map>, IMapAccessorKeyOf<Key>, IMapAccessorValueOf<Value>, IConstructorAccessor<Map, IEnumerable<KeyValuePair<Key, Value>>>, IDeconstructorAccessor<Map, IEnumerable<KeyValuePair<Key, Value>>>
    {
        /// <summary>Get reference to value</summary>
        new IWriter Referer { get; set; }
        /// <summary>Remove at key</summary>
        new IWriterBase<Key, Map> Remove { get; set; }
        /// <summary>Get value at key.</summary>
        new IWriterBase<(Map, Key), Value> Get { get; set; }
        /// <summary>Set value at key.</summary>
        new IWriterBase<(Key, Value), Map> Set { get; set; }
        /// <summary>Clear list.</summary>
        new IWriterBase<Avalanche.Void, Map> Clear { get; set; }
        /// <summary>Count.</summary>
        new IWriterBase<Map, long> Count { get; set; }
    }
    

    IMapVisitor and IMapVisitorT are visitor interfaces for IAccessorBase.Accept(IAccessorVisitor).

    /// <summary>Base interface for map visitor</summary>
    public interface IMapVisitor : IAccessorVisitor
    {
        /// <summary>Try visit <paramref name="mapAccessor"/>.</summary>
        /// <returns>true to continue visitation</returns>
        bool VisitMapAccessor(IMapAccessor mapAccessor);
    }
    
    /// <summary>Base interface for map visitor</summary>
    public interface IMapVisitorT : IAccessorVisitor
    {
        /// <summary>Try visit <paramref name="mapAccessor"/>.</summary>
        /// <returns>true to continue visitation</returns>
        bool VisitMapAccessor<Map, Key, Value>(IMapAccessor<Map, Key, Value> mapAccessor);
    }
    

    MapAccessor

    AccessorBase
    └── MapAccessor
        └── MapAccessor<Container>
            └── MapAccessor<Container, Key, Value>
    

    MapAccessor<Map, Key, Value> is the default implementation.

    IMapAccessor<Dictionary<string, int>, string, int> mapAccessor = new MapAccessor<Dictionary<string, int>, string, int>()
    {
        Constructor = null!,
        Deconstructor = null!,
        DefaultConstructor = null!,
        Referer = null!,
        Remove = null!,
        Get = null!,
        Set = null!,
        Clear = null!,
        Count = null!,
        IsAssigned = null!,
        Unassign = null!
    }.SetReadOnly();
    

    MapAccessor.Create(Type, Type, Type) also constructs IMapAccessor<Map, Key, Value>. There is a setter method for each field.

    IMapAccessor<Dictionary<string, int>, string, int> mapAccessor =
        (IMapAccessor<Dictionary<string, int>, string, int>)
        MapAccessor.Create(typeof(Dictionary<string, int>), typeof(string), typeof(int))
        .SetConstructor(null!)
        .SetDeconstructor(null!)
        .SetDefaultConstructor(null!)
        .SetReferer(null!)
        .SetRemove(null!)
        .SetGet(null!)
        .SetSet(null!)
        .SetClear(null!)
        .SetCount(null!)
        .SetIsAssigned(null!)
        .SetUnassign(null!)
        .SetReadOnly();
    

    Query

    AccessorRequest(target) requests for IAccessor depending on type target.

    // Create service
    IService service = Services.Create(NetAccessorHandlers.Instance);
    // Create container target
    IContainerTarget target = new NetMap(typeof(Dictionary<string, int>));
    // Create request
    IRequestFor<IAccessor> request = new AccessorRequest(target);
    // Issue request
    IMapAccessor<Dictionary<string, int>, string, int> accessor = service.GetRequired<IRequest, IMapAccessor<Dictionary<string, int>, string, int>>(request);
    

    MapAccessorRequest(target) requests for IMapAccessor<Map, Key, Value>.

    // Create service
    IService service = Services.Create(NetAccessorHandlers.Instance);
    // Create container target
    IContainerTarget target = new NetMap(typeof(Dictionary<string, int>));
    // Create request
    IRequestFor<IMapAccessor> request = new MapAccessorRequest(target);
    // Issue request
    IMapAccessor<Dictionary<string, int>, string, int> accessor = service.GetRequired<IRequest, IMapAccessor<Dictionary<string, int>, string, int>>(request);
    

    MapAccessorRequest is specifically a request for specific writers. Each can be assigned with explicit customization.

    // Create service
    IService service = Services.Create(NetAccessorHandlers.Instance);
    // Create container target
    IContainerTarget target = new NetMap(typeof(Dictionary<string, int>));
    // Create request
    IRequestFor<IMapAccessor> request = new MapAccessorRequest
    {
        Constructor = new ConstructorRequest(target),
        Deconstructor = new DeconstructorRequest(target),
        DefaultConstructor = new DefaultConstructorRequest(target),
        Remove = new RemoveRequest(target),
        Get = new GetRequest(target),
        Set = new SetRequest(target),
        Clear = new ClearRequest(target),
        Count = new CountRequest(target),
        IsAssigned = new IsAssignedRequest(target),
        Unassign = new UnassignRequest(target),
        ContainerType = new ContainerTypeRequest(target),
        KeyType = new KeyTypeRequest(target),
        ValueType = new ValueTypeRequest(target),
        Referer = new RefererRequest(target),
    };
    // Issue request
    IMapAccessor<Dictionary<string, int>, string, int> accessor = service.GetRequired<IRequest, IMapAccessor<Dictionary<string, int>, string, int>>(request);
    

    Usage

    .DefaultConstructor creates a map with default value.

    Dictionary<string, int> map = accessor.DefaultConstructor.Read();
    

    .Constructor creates a map from enumerable of elements.

    Dictionary<string, int> map = accessor.Constructor.ReadAs<IEnumerable<KeyValuePair<string, int>>, Dictionary<string, int>>(new Dictionary<string, int> { { "A", 1 }, { "B", 2 }, { "C", 3 } });
    

    .Deconstructor reads values as an enumerable.

    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
    IEnumerable<KeyValuePair<string, int>> deconstruction = accessor.Deconstructor.Read(map);
    

    .Remove removes an element at index.

    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
    accessor.Remove.Write("B", map);
    

    .Get reads an element at index.

    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
    int value = accessor.Get.Read((map, "B"));
    

    .Set assigns an element at index.

    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
    accessor.Set.Write(("D", 10), map);
    

    .Clear removes all elements.

    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
    accessor.Clear.Write(default, map);
    

    .Count returns the number of elements.

    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
    long count = accessor.Count.Read(map);
    

    .IsAssigned tests whether a map is assigned in container.

    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
    bool nonNull = accessor.IsAssigned.Read(map);
    

    .Unassign removes map at container.

    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
    accessor.Unassign.Write(default, ref map);
    

    .Referer get a reference to element.

    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
    ref int element = ref ((IReferer<(Dictionary<string, int>, string), int>)accessor.Referer).GetReference((map, "B"));
    

    Full Example

    Full example
    using System;
    using System.Collections.Generic;
    using Avalanche.Accessor;
    using Avalanche.DataType;
    using Avalanche.Service;
    using Avalanche.Utilities;
    using Avalanche.Writer;
    using Microsoft.Extensions.DependencyInjection;
    
    public class mapaccessor
    {
        public static void Run()
        {
            {
                // <01>
                IMapAccessor<Dictionary<string, int>, string, int> mapAccessor = new MapAccessor<Dictionary<string, int>, string, int>()
                {
                    Constructor = null!,
                    Deconstructor = null!,
                    DefaultConstructor = null!,
                    Referer = null!,
                    Remove = null!,
                    Get = null!,
                    Set = null!,
                    Clear = null!,
                    Count = null!,
                    IsAssigned = null!,
                    Unassign = null!
                }.SetReadOnly();
                // </01>
            }
            {
                // <02>
                IMapAccessor<Dictionary<string, int>, string, int> mapAccessor =
                    (IMapAccessor<Dictionary<string, int>, string, int>)
                    MapAccessor.Create(typeof(Dictionary<string, int>), typeof(string), typeof(int))
                    .SetConstructor(null!)
                    .SetDeconstructor(null!)
                    .SetDefaultConstructor(null!)
                    .SetReferer(null!)
                    .SetRemove(null!)
                    .SetGet(null!)
                    .SetSet(null!)
                    .SetClear(null!)
                    .SetCount(null!)
                    .SetIsAssigned(null!)
                    .SetUnassign(null!)
                    .SetReadOnly();
                // </02>
            }
    
            {
                // <10>
                // Create service
                IService service = Services.Create(NetAccessorHandlers.Instance);
                // Create container target
                IContainerTarget target = new NetMap(typeof(Dictionary<string, int>));
                // Create request
                IRequestFor<IAccessor> request = new AccessorRequest(target);
                // Issue request
                IMapAccessor<Dictionary<string, int>, string, int> accessor = service.GetRequired<IRequest, IMapAccessor<Dictionary<string, int>, string, int>>(request);
                // </10>
            }
            {
                // <11>
                // Create service
                IService service = Services.Create(NetAccessorHandlers.Instance);
                // Create container target
                IContainerTarget target = new NetMap(typeof(Dictionary<string, int>));
                // Create request
                IRequestFor<IMapAccessor> request = new MapAccessorRequest(target);
                // Issue request
                IMapAccessor<Dictionary<string, int>, string, int> accessor = service.GetRequired<IRequest, IMapAccessor<Dictionary<string, int>, string, int>>(request);
                // </11>
            }
            {
                // <12>
                // Create service
                IService service = Services.Create(NetAccessorHandlers.Instance);
                // Create container target
                IContainerTarget target = new NetMap(typeof(Dictionary<string, int>));
                // Create request
                IRequestFor<IMapAccessor> request = new MapAccessorRequest
                {
                    Constructor = new ConstructorRequest(target),
                    Deconstructor = new DeconstructorRequest(target),
                    DefaultConstructor = new DefaultConstructorRequest(target),
                    Remove = new RemoveRequest(target),
                    Get = new GetRequest(target),
                    Set = new SetRequest(target),
                    Clear = new ClearRequest(target),
                    Count = new CountRequest(target),
                    IsAssigned = new IsAssignedRequest(target),
                    Unassign = new UnassignRequest(target),
                    ContainerType = new ContainerTypeRequest(target),
                    KeyType = new KeyTypeRequest(target),
                    ValueType = new ValueTypeRequest(target),
                    Referer = new RefererRequest(target),
                };
                // Issue request
                IMapAccessor<Dictionary<string, int>, string, int> accessor = service.GetRequired<IRequest, IMapAccessor<Dictionary<string, int>, string, int>>(request);
                // </12>
            }
            
            {
                IMapAccessor<Dictionary<string, int>, string, int> accessor = Services.Create(NetAccessorHandlers.Instance).GetRequiredService<IMapAccessor<Dictionary<string, int>, string, int>>();
                {
                    // <51>
                    Dictionary<string, int> map = accessor.DefaultConstructor.Read();
                    // </51>
                }
                {
                    // <52>
                    Dictionary<string, int> map = accessor.Constructor.ReadAs<IEnumerable<KeyValuePair<string, int>>, Dictionary<string, int>>(new Dictionary<string, int> { { "A", 1 }, { "B", 2 }, { "C", 3 } });
                    // </52>
                }
                {
                    // <53>
                    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
                    IEnumerable<KeyValuePair<string, int>> deconstruction = accessor.Deconstructor.Read(map);
                    // </53>
                }
                {
                    // <56>
                    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
                    accessor.Remove.Write("B", map);
                    // </56>
                }
                {
                    // <57>
                    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
                    int value = accessor.Get.Read((map, "B"));
                    // </57>
                }
                {
                    // <58>
                    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
                    accessor.Set.Write(("D", 10), map);
                    // </58>
                }
                {
                    // <60>
                    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
                    accessor.Clear.Write(default, map);
                    // </60>
                }
                {
                    // <61>
                    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
                    long count = accessor.Count.Read(map);
                    // </61>
                }
                {
                    // <62>
                    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
                    bool nonNull = accessor.IsAssigned.Read(map);
                    // </62>
                }
                {
                    // <63>
                    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
                    accessor.Unassign.Write(default, ref map);
                    // </63>
                }
                {
                    // <64>
                    Dictionary<string, int> map = new Dictionary<string, int> { { "A", 7 }, { "B", 8 }, { "C", 9 } };
                    ref int element = ref ((IReferer<(Dictionary<string, int>, string), int>)accessor.Referer).GetReference((map, "B"));
                    // </64>
                }
            }
        }
    }
    
    In This Article
    Back to top Copyright © Toni Kalajainen