IDictionary
DataTypeRequest<NetMap> is a request for map type of Type. (Avalanche.DataType.Net.dll)
// Create service
IService service = Services.Create(NetTypeHandlers.Instance);
// Create map request
DataTypeRequest<NetMap> mapRequest = new(typeof(Dictionary<string, int>));
// Request map
IMapType mapType = service.GetRequired<IDataTypeRequest, IMapType>(mapRequest);
System.Collections.Generic.Dictionary`2[[System.String],[System.Int32]] : IMapType ├── Key = string : IStringType │ └── Element = char : IIntegerType └── Value = int : IIntegerType
Default handlers process IDictionary<K,V> types on DataTypeRequest<NetMap>.
DataTypeRequest<NetMap> mapRequest = new(typeof(IDictionary<string, int>));
DataTypeRequest<NetMap> mapRequest = new(typeof(ConcurrentDictionary<string, int>));
Full Example
Full example
using System.Collections.Concurrent;
using System.Collections.Generic;
using Avalanche.DataType;
using Avalanche.Identity;
using Avalanche.Service;
using Avalanche.Utilities;
using static System.Console;
public class idictionary
{
public static void Run()
{
{
// <04>
// Create service
IService service = Services.Create(NetTypeHandlers.Instance);
// Create map request
DataTypeRequest<NetMap> mapRequest = new(typeof(Dictionary<string, int>));
// Request map
IMapType mapType = service.GetRequired<IDataTypeRequest, IMapType>(mapRequest);
// </04>
// Print
WriteLine(mapType.PrintTree());
}
{
// Create service
IService service = Services.Create(NetTypeHandlers.Instance);
// Create map request
// <05>
DataTypeRequest<NetMap> mapRequest = new(typeof(IDictionary<string, int>));
// </05>
// Request map
IMapType mapType = service.GetRequired<IDataTypeRequest, IMapType>(mapRequest);
// Print
WriteLine(mapType.PrintTree());
}
{
// Create service
IService service = Services.Create(NetTypeHandlers.Instance);
// Create map request
// <06>
DataTypeRequest<NetMap> mapRequest = new(typeof(ConcurrentDictionary<string, int>));
// </06>
// Request map
IMapType mapType = service.GetRequired<IDataTypeRequest, IMapType>(mapRequest);
// Print
WriteLine(mapType.PrintTree());
}
}
}