.NET Portable TypeCast  3.1.0.4
A, easy-to-use tested, generic, portable, runtime-extensible, arbitrary type converter library
Core.TypeCast.ConverterCollection Class Reference

The thread-safe, static collection of Converter items, using Core.Singleton and supporting Core.Singleton.ISingleton More...

+ Collaboration diagram for Core.TypeCast.ConverterCollection:

Classes

class  AddBuilder
 Allows to perform a deferred adding operation of multiple adds using a common Base-Class Type argument, common ConverterCollectionSettings as well as a mutual CancellationToken for the added group of converters. The operation is applied upon invoking End, and can be explicitly canceled by invoking Cancel More...
 

Public Member Functions

 ConverterCollection ()
 Initializes a new instance of the ConverterCollection class with default-parameters. More...
 
 ConverterCollection (Type application)
 Initializes a new instance of the ConverterCollection class with default-parameters. More...
 
 ConverterCollection (Type application, Type converterClass, NumberFormatInfo numberFormatDefault=null)
 Initializes a new instance of the ConverterCollection class with default-parameters. More...
 
 ConverterCollection (Assembly assembly, NumberFormatInfo numberFormatDefault=null)
 Initializes a new instance of the ConverterCollection class with default-parameters. More...
 
 ConverterCollection (Type application=null, params Type[] converterClasses)
 Initializes a new instance of the ConverterCollection class with default-parameters. More...
 
IConverterCollection Add (object converterDelegate, Type baseType=null, CancellationToken cancellationToken=default(CancellationToken))
 Initializes a new instance of the ConverterCollection class with default-parameters. More...
 
IConverterCollection Add (MethodInfo methodInfo, object converterDelegate=null, Type baseType=null, object baseInstance=null, CancellationToken cancellationToken=default(CancellationToken))
 Creates and adds a Converter instance to the collection of ConverterCollection.Items using a MethodInfo instance More...
 
IConverterCollection Add (Converter converter, Type baseType=null, bool allowDisambiguates=false, CancellationToken cancellationToken=default(CancellationToken))
 Adds a Converter instance to the collection of ConverterCollection.Items More...
 
bool CanConvertFrom (Type typeFrom)
 Returns bool true if the ConverterCollection supports conversion for a given Type typeFrom , else false. More...
 
bool CanConvertFrom< TIn > ()
 Returns bool true if the ConverterCollection supports conversion for a given Type typeFrom , else false. More...
 
bool CanConvertTo (Type typeTo)
 Returns bool true if the ConverterCollection supports conversion for a given Type typeTo , else false. More...
 
bool CanConvertTo< TOut > ()
 Returns bool true if the ConverterCollection supports conversion for a given Type typeTo , else false. More...
 
ConverterAttribute ConverterAttributeFromIConverter (TypeInfo baseType, ConverterAttribute attribute=null, bool update=false)
 Adds or updates an attribute for a Converter if it exists, dependent only on the source and target conversion types More...
 
int LoadOnDemandConverter (Type typeTo)
 Tries to lookup the namespace obtained from typeTo in loadOnDemandConverters and add the converters. If successful the number of Added Converters are returned, and the NameSpace is removed from the list of loadOnDemandConverters. More...
 
void Initialize (string applicationNameSpace)
 Initializes all attributed Converter classes, Initialize(Assembly[]) More...
 
void Initialize (Type applicationClass)
 Initializes all attributed Converter classes, Initialize(Assembly[]) More...
 
void Initialize (Assembly assembly)
 Initializes all attributed Converter classes, Initialize(Assembly[]) More...
 
void Initialize (Assembly[] assemblies)
 Initializes all attributed Converter classes, unless the ConverterAttribute parameter ConverterAttribute.LoadOnDemand is false More...
 
void Initialize (IEnumerable< TypeInfo > types)
 Initializes all attributed Converter classes, unless the ConverterAttribute parameter ConverterAttribute.LoadOnDemand is false More...
 
IEnumerator< ConverterGetEnumerator ()
 Returns an enumerator that iterates through the collection. More...
 
IConverterCollection Add< TIn, TOut > (Func< TIn, TOut > converterAction, Type baseType=null, CancellationToken cancellationToken=default(CancellationToken))
 Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate More...
 
IConverterCollection Add< TIn, TOut, TBase > (Func< TIn, TOut > converterAction, CancellationToken cancellationToken=default(CancellationToken))
 Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate More...
 
IConverterCollection Add< TIn, TOut, TBase > (Func< TIn, TOut, TOut > converterAction, CancellationToken cancellationToken=default(CancellationToken))
 Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate More...
 
IConverterCollection Add< TIn, TArg, TOut > (Func< TIn, TArg, TOut > converterActionAny, Type baseType=null, CancellationToken cancellationToken=default(CancellationToken))
 Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate More...
 
IConverterCollection Add< TBase > (object converterDelegate, CancellationToken cancellationToken=default(CancellationToken))
 Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate More...
 

Static Public Member Functions

static void AutoInitialize ()
 Checks if the ConverterCollection is initialized. Attempts to initialize and load the user-assembly if ConverterCollection.Initialized is false More...
 

Protected Member Functions

override void Dispose (bool disposing)
 Dispose of the Items and underlying static Singleton<TClass> references. More...
 
bool SetAssemblyInitialized (TypeInfo type)
 Sets the Assembly as initialized in AssemblyInitialized More...
 
bool SetConverterClassInitialized (TypeInfo converterClass)
 Sets the Converter of the ConverterCollection as initialized More...
 

Properties

ConverterCollectionSettings Settings [get, set]
 The settings for the ConverterCollection. More...
 
ConcurrentDictionary< Assembly, bool > AssemblyInitialized [get]
 Sets the Assembly as initialized in AssemblyInitialized More...
 
BlockingCollection< ConverterItems [get]
 The BlockingCollection<Converter> class provides a thread-safe collection with full support of the Producer-Consumer pattern, to store a collection of Converter instances. More...
 
int Count [get]
 Gets the count of singletons in the list. More...
 

Detailed Description

The thread-safe, static collection of Converter items, using Core.Singleton and supporting Core.Singleton.ISingleton

See https://github.com/lsauer/csharp-singleton for more information.

Building the project requires the Singleton-library: https://www.nuget.org/packages/CSharp.Portable-Singleton/

If SingletonAttribute.CreateInternal is set to false, ConverterCollection must explicitly be instantiated using new ConverterCollection(...) and not use ConverterCollection.CurrentInstance before instantiation. If SingletonAttribute.CreateInternal is set to true, lazy-instantiation of the singleton is possible at any time, after the program's assembly entry point is reached.

Definition at line 37 of file ConverterCollection.AddBuilder.cs.

Constructor & Destructor Documentation

Core.TypeCast.ConverterCollection.ConverterCollection ( )

Initializes a new instance of the ConverterCollection class with default-parameters.

Instantiation with new ConverterCollection(...) must only be once and before any functions that require Singleton<ConverterCollection>.CurrentInstance

Definition at line 61 of file ConverterCollection.cs.

62  : this(application: null, numberFormatDefault: null, converterClasses: null)
63  {
64  }
Core.TypeCast.ConverterCollection.ConverterCollection ( Type  application)

Initializes a new instance of the ConverterCollection class with default-parameters.

Instantiation with new ConverterCollection(...) must only be once and before any functions that require Singleton<ConverterCollection>.CurrentInstance

Parameters
applicationThe TypeInfo.BaseType type which serves as the assembly entry point of the application e.g. Program

Definition at line 72 of file ConverterCollection.cs.

73  : this(application: application, numberFormatDefault: null, converterClasses: null)
74  {
75  }
Core.TypeCast.ConverterCollection.ConverterCollection ( Type  application,
Type  converterClass,
NumberFormatInfo  numberFormatDefault = null 
)

Initializes a new instance of the ConverterCollection class with default-parameters.

Instantiation with new ConverterCollection(...) must only be once and before any functions that require Singleton<ConverterCollection>.CurrentInstance

Parameters
applicationThe TypeInfo.BaseType type which serves as the assembly entry point of the application e.g. Program
converterClassThe type of a converter class to look for converters and load into the collection
numberFormatDefaultAn optional NumberFormatInfo to provide to any added converters for formatting.

Definition at line 85 of file ConverterCollection.cs.

86  : this(application: application, numberFormatDefault: numberFormatDefault, converterClasses: converterClass)
87  {
88  }
Core.TypeCast.ConverterCollection.ConverterCollection ( Assembly  assembly,
NumberFormatInfo  numberFormatDefault = null 
)

Initializes a new instance of the ConverterCollection class with default-parameters.

Instantiation with new ConverterCollection(...) must only be once and before any functions that require Singleton<ConverterCollection>.CurrentInstance

Parameters
assemblyAn assembly to look for ConverterAttribute to discover and load converters into the collection
numberFormatDefaultAn optional NumberFormatInfo to provide to any added converters for formatting.

Definition at line 97 of file ConverterCollection.cs.

98  : this(application: null, numberFormatDefault: numberFormatDefault, converterClasses: null)
99  {
100  this.Initialize(assembly);
101  }
void Initialize(string applicationNameSpace)
Initializes all attributed Converter classes, Initialize(Assembly[])
Core.TypeCast.ConverterCollection.ConverterCollection ( Type  application = null,
params Type[]  converterClasses 
)

Initializes a new instance of the ConverterCollection class with default-parameters.

Parameters
applicationThe TypeInfo.BaseType type which serves as the assembly entry point of the application e.g. Program
converterClassThe type of a converter class to look for converters and load into the collection Items

Definition at line 108 of file ConverterCollection.cs.

109  : this(application: application, numberFormatDefault: null, converterClasses: converterClasses)
110  {
111  }

+ Here is the call graph for this function:

Member Function Documentation

IConverterCollection Core.TypeCast.ConverterCollection.Add ( object  converterDelegate,
Type  baseType = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)

Initializes a new instance of the ConverterCollection class with default-parameters.

Example: Initialize a new ConverterCollection with several custom parameters, before any invocation of a ConverterCollection instance

```cs
var cc = new ConverterCollection(typeof(Program), typeof(CustomConverters), typeof(DNA))
{
AutoReset = true,
Settings = new ConverterCollectionSettings()
{
ConverterDefaultWrapperOrException = true
}
};
```
Parameters
applicationThe TypeInfo.BaseType type which serves as the assembly entry point of the application e.g. Program
numberFormatDefaultAn optional NumberFormatInfo to provide to any added converters for formatting.
converterClassThe types of a converter classes to encapsulate in Converter instances and add into the collection Items

*/ public ConverterCollection(Type application = null, NumberFormatInfo numberFormatDefault = null, params Type[] converterClasses) { this.Settings = new ConverterCollectionSettings(); this.loadOnDemandConverters = new Dictionary<string, List<Type>>();

this.Factory = new ConverterFactory(); this.FactoryBaseClass = new BaseClassFactoryRT();

this.AssemblyInitialized = new ConcurrentDictionary<Assembly, bool>(); this.ConverterClassInitialized = new ConcurrentDictionary<TypeInfo, bool>(); this.ConstructorAddedClasses = new List<Type>(); this.Items = new BlockingCollection<Converter>(boundedCapacity: this.Settings.BoundedCapacity);

if(application != null) { ApplicationNameSpace = application.Namespace; this.Initialize(ApplicationNameSpace); }

if(numberFormatDefault as NumberFormatInfo != null) { this.Settings.NumberFormat = numberFormatDefault; }

if(converterClasses != null) { foreach(var converterClass in converterClasses) { if(converterClass != null && converterClass.GetTypeInfo().IsClass == true) { ConstructorAddedClasses.Add(converterClass);

this.AddAllConvertersByAttribute(converterClass.GetTypeInfo()); } } }

// Load any declared converters from the own assembly this.Initialize(this.GetType().GetTypeInfo()?.Assembly.DefinedTypes); }

/**

Reference to the ConverterFactory which facilitates the instantiation of any Converter

*/ public ConverterFactory Factory { get; }

/**

Reference to the runtime-creation BaseClassFactoryRT which facilitates the instantiation of any class which declares a converter function and has a ConverterAttribute

*/ public BaseClassFactoryRT FactoryBaseClass { get; }

/**

Stores the namespace of the application namespace. May be set during auto-initialization loading

*/ public string ApplicationNameSpace { get; set; }

/**

Stores a list of classes that were passed into the constructor as a params list of types and have been added to Items

*/ public List<Type> ConstructorAddedClasses { get; }

/**

Stores a list of assemblies which have been scanned for attributes and added to Items

*/ public ConcurrentDictionary<Assembly, bool> AssemblyInitialized { get; }

/**

Stores a list of the types of Converter function declaring-classes which have been instantiated and added to Items

*/ public ConcurrentDictionary<TypeInfo, bool> ConverterClassInitialized { get; }

/**

Gets the count of singletons in the list.

``` var singletonManager = new SingletonManager(new[]{typeof(ParentOfAClass), typeof(IndispensibleClass)});

singletonManager.PropertyChanged += (singleton, arg) => { if(singletonManager.Count < singletonManager.Pool.Count() ){ Console.WriteLine("A Singleton was added to the Manager"); }else{ Console.WriteLine("A Singleton was removed from the Manager"); } } ```

*/ public int Count { get { return this.Items.Count; }

private set { if(value != this.count) { OnPropertyChanged(); this.count = value; } } }

/**

The BlockingCollection<Converter> class provides a thread-safe collection with full support of the Producer-Consumer pattern, to store a collection of Converter instances.

*/ public BlockingCollection<Converter> Items { get; }

/**

Marks the T:System.Collections.Concurrent.BlockingCollection`1 instances as not accepting any more additions.

Exceptions
T:System.ObjectDisposedExceptionThe T:System.Collections.Concurrent.BlockingCollection`1 has been disposed.

*/ public bool IsAddingCompleted { get { return this.Items.IsAddingCompleted; } set { if(value == true) { this.Items.CompleteAdding(); }

} }

/**

Gets the type of the element(s) that are returned when the expression tree associated with this instance of System.Linq.IQueryable is executed.

Returns
A Type that represents the type of the element(s) that are returned when the expression tree associated with this object is executed.

*/ public Type ElementType { get { return this.Items.AsQueryable().ElementType; } }

/**

Gets the expression tree that is associated with the instance of System.Linq.IQueryable.

Returns
The System.Linq.Expressions.Expression that is associated with this instance of System.Linq.IQueryable.

*/ public Expression Expression { get { return this.Items.AsQueryable().Expression; } }

/**

Gets the query provider that is associated with this data source.

Returns
The System.Linq.IQueryProvider that is associated with this data source.

*/ public IQueryProvider Provider { get { return this.Items.AsQueryable().Provider; } }

/**

Gets the value for a given index using System.Linq

Parameters
indexThe integer index of the elements starting at zero.
Returns
A single Converter instance if a Type match was found was found, else null.

*/ public Converter this[int index] { get { return this.Items?.Skip(index)?.FirstOrDefault(); } }

/**

Gets a Converter for a given Key by invoking Get(TypeInfo, TypeInfo). If none is found, null is returned.

Parameters
typeFromThe source Type to look up in Items
typeToThe target Type to look up in Items
Returns
A single Converter instance if a Type match was found was found, else null.

*/ public Converter this[Type typeFrom, Type typeTo] { get { return this.Get(typeFrom.GetTypeInfo(), typeTo.GetTypeInfo()); } }

/**

Gets a Converter for a given Key by invoking Get(TypeInfo, TypeInfo). If none is found, null is returned.

Parameters
typeFromThe source Type to look up in Items
typeToThe target Type to look up in Items
Returns
A single Converter instance if a Type match was found was found, else null.

*/ public Converter this[TypeInfo typeFrom, TypeInfo typeTo] { get { return this.Get(typeFrom, typeTo); } }

/**

Looks up all converters that match the source-type argument typeFrom and returns an IEnumerable<Converter>

Parameters
typeFromThe source Type to look up in Items
Returns
A IEnumerable of Converter instances if a Type match was found was found, else null.

*/ public IEnumerable<Converter> this[TypeInfo typeFrom] { get { return this.WithFrom(typeFrom); } }

/**

Allows to perform a deferred adding operation of multiple adds using a common Base-Class Type argument, common ConverterCollectionSettings as well as a mutual CancellationToken for the added group of converters. The operation is applied upon invoking End, and can be explicitly canceled by invoking Cancel

Template Parameters
TBaseThe declaring Type of the converter-functions to add as a group.
Parameters
settingsOptional common ConverterCollectionSettings to be applied for the added group of converter-functions
cancellationTokenOptional mutual CancellationToken to be used for the grouped-adding of converter-functions
Returns
Returns a (nested-class) instance of AddBuilder<TBase> with strongly-typed generic methods for deferred grouped-adding.

*/ public AddBuilder<TBase> AddStart<TBase>(ConverterCollectionSettings settings = null, CancellationToken cancellationToken = default(CancellationToken)) where TBase : class { return new AddBuilder<TBase>(this, settings: settings, cancellationToken: ref cancellationToken); }

/**

Allows to perform a deferred adding operation of multiple adds using a common Base-Class Type argument, common ConverterCollectionSettings as well as a mutual CancellationToken for the added group of converters. The operation is applied upon invoking End, and can be explicitly canceled by invoking Cancel

Template Parameters
TBaseThe declaring Type of the converter-functions to add as a group.
Parameters
settingsCommon ConverterCollectionSettings to be applied for the added group of converter-functions
cancellationTokenMutual CancellationToken to be used for the grouped-adding of converter-functions
Returns
Returns a (nested-class) instance of AddBuilder<TBase> with strongly-typed generic methods for deferred grouped-adding.

*/ public AddBuilder<TBase> AddStart<TBase>(ConverterCollectionSettings settings, ref CancellationToken cancellationToken) where TBase : class { return new AddBuilder<TBase>(this, settings: settings, cancellationToken: ref cancellationToken); }

/**

Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate

Parameters
converterActionA function delegate Func<TIn, TOut> to use as the Converter.Function
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
baseTypeThe Type of the declaring and attributed custom converter class, if one exists
Template Parameters
TInThe Source- / From- Typefrom which to Converter<TIn,TOut>.Convert(object,object)
TOutThe Target / To- Type to which to Converter<TIn,TOut>.Convert(object,object)
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterExceptionThrows a ConverterCause.ConverterCollectionAddFailed with a wrapped Exception.InnerException if an internal error occurred

*/ public IConverterCollection Add<TIn, TOut>( Func<TIn, TOut> converterAction, Type baseType = null, CancellationToken cancellationToken = default(CancellationToken)) { var converter = Factory.Create<TIn, TOut>(converterAction); return this.Add(converter: converter, baseType: baseType, cancellationToken: cancellationToken); }

/**

Creates and adds a pair of Converter instances to the collection of ConverterCollection.Items using a Delegate, which together form an Inter-converter, for mutual conversion between two types in either conversion direction.

Parameters
converterActionForwardA source-to-target Type converting function delegate Func<TIn, TOut> to use as the Converter.Function
converterActionBackwardA target-to-source Type converting function delegate Func<TOut, TIn> to use as the Converter.Function
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
baseTypeThe Type of the declaring and attributed custom converter class, if one exists
Template Parameters
TInThe Source- / From- Typefrom which to Converter<TIn,TOut>.Convert(object,object)
TOutThe Target / To- Type to which to Converter<TIn,TOut>.Convert(object,object)
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterExceptionThrows a ConverterCause.ConverterCollectionAddFailed with a wrapped Exception.InnerException if an internal error occurred

*/ public IConverterCollection Add<TIn, TOut>( Func<TIn, TOut> converterActionForward, Func<TOut, TIn> converterActionBackward, Type baseType = null, CancellationToken cancellationToken = default(CancellationToken)) { this.Add(converterAction: converterActionForward, baseType: baseType, cancellationToken: cancellationToken); return this.Add(converterAction: converterActionBackward, baseType: baseType, cancellationToken: cancellationToken); }

/**

Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate

Template Parameters
TInThe Source- / From- Typefrom which to Converter<TIn,TOut>.Convert(object,object)
TOutThe Target / To- Type to which to Converter<TIn,TOut>.Convert(object,object)
TBaseThe Type of the declaring and attributed custom converter class
Parameters
converterActionA function delegate Func<TIn, TOut> to use as the Converter.Function
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterExceptionThrows a ConverterCause.ConverterCollectionAddFailed with a wrapped Exception.InnerException if an internal error occurred

*/ public IConverterCollection Add<TIn, TOut, TBase>(Func<TIn, TOut> converterAction, CancellationToken cancellationToken = default(CancellationToken)) where TBase : class { var converter = Factory.Create<TIn, TOut>(converterAction); return this.Add(converter: converter, baseType: typeof(TBase), cancellationToken: cancellationToken); }

/**

Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate

Template Parameters
TInThe Source- / From- Typefrom which to Converter<TIn,TOut>.Convert(object,object)
TOutThe Target / To- Type to which to Converter<TIn,TOut>.Convert(object,object)
Parameters
converterActionDefaultA function delegate Func<TIn, TOut, TOut> to use as the Converter.Function
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterExceptionThrows a ConverterCause.ConverterCollectionAddFailed with a wrapped Exception.InnerException if an internal error occurred

*/ public IConverterCollection Add<TIn, TOut, TBase>( Func<TIn, TOut, TOut> converterActionDefault, CancellationToken cancellationToken = default(CancellationToken)) where TBase : class { var converter = Factory.Create<TIn, TOut>(converterActionDefault); return this.Add(converter: converter, baseType: typeof(TBase), cancellationToken: cancellationToken); }

/**

Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate

Parameters
converterActionAnyA function delegate Func<TIn, TArg, TOut> to use as the Converter.Function
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
Template Parameters
TInThe Source- / From- Typefrom which to Converter<TIn,TOut>.Convert(object,object)
TOutThe Target / To- Type to which to Converter<TIn,TOut>.Convert(object,object)
TArgThe Argument Type for generic converters using see ObjectExtension.ConvertTo<TIn, TOut>(TIn, object).
TBaseThe Type of the declaring and attributed custom converter class, if one exists
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterExceptionThrows a ConverterCause.ConverterCollectionAddFailed with a wrapped Exception.InnerException if an internal error occurred

*/ public IConverterCollection Add<TIn, TArg, TOut, TBase>( Func<TIn, TArg, TOut> converterActionAny, CancellationToken cancellationToken = default(CancellationToken)) { if(typeof(TOut) == typeof(TArg)) { var converter = Factory.Create<TIn, TOut>((Func<TIn, TOut, TOut>)(object)converterActionAny); return this.Add(converter: converter, baseType: typeof(TBase), cancellationToken: cancellationToken); } return this.Add(converterDelegate: converterActionAny, baseType: typeof(TBase), cancellationToken: cancellationToken); }

/**

Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate

Parameters
converterActionAnyA function delegate Func<TIn, TArg, TOut> to use as the Converter.Function
baseTypeThe Type of the declaring and attributed custom converter class, if one exists
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
Template Parameters
TInThe Source- / From- Typefrom which to Converter<TIn,TOut>.Convert(object,object)
TOutThe Target / To- Type to which to Converter<TIn,TOut>.Convert(object,object)
TArgThe Argument Type for generic converters using see ObjectExtension.ConvertTo<TIn, TOut>(TIn, object).
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterExceptionThrows a ConverterCause.ConverterCollectionAddFailed with a wrapped Exception.InnerException if an internal error occurred
*/ public IConverterCollection Add<TIn, TArg, TOut>( Func<TIn, TArg, TOut> converterActionAny, Type baseType = null, CancellationToken cancellationToken = default(CancellationToken)) { if(typeof(TOut) == typeof(TArg)) { var converter = Factory.Create<TIn, TOut>((Func<TIn, TOut, TOut>)(object)converterActionAny); return this.Add(converter: converter, baseType: baseType, cancellationToken: cancellationToken); } return this.Add(converterDelegate: converterActionAny, baseType: baseType, cancellationToken: cancellationToken); }

/**

Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate

Parameters
converterDelegateAn optional function delegate to use as the Converter.Function
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterExceptionThrows a ConverterCause.ConverterCollectionAddFailed with a wrapped Exception.InnerException if an internal error occurred

*/ public IConverterCollection Add<TBase>(object converterDelegate, CancellationToken cancellationToken = default(CancellationToken)) where TBase : class { return this.Add(converterDelegate: converterDelegate, baseType: typeof(TBase), cancellationToken: cancellationToken); }

/**

Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate

Parameters
converterDelegateAn optional function delegate to use as the Converter.Function
baseTypeThe Type of the declaring and attributed custom converter class, if one exists
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
Returns
Returns a IConverterCollection for safe, constricted function chaining.

Example: Add a converter to the ConverterCollection cc, to converter Nullable<int> to float

```cs
var cc = new ConverterCollection(typeof(Program));
// Converter: [Nullable<int>] &ndash;> [float]
cc.Add((int? a) =>
{
return (float)(a ?? 0);
});
```

Any lambda function or strictly declared function can be added as converterDelegate . For more information visit the MSDN recommendations on lambda expressions: https://msdn.microsoft.com/en-us/library/bb397687.aspx

Exceptions
ConverterExceptionThrows a ConverterCause.ConverterCollectionAddFailed with a wrapped Exception.InnerException if an internal error occurred

Implements Core.TypeCast.IConverterCollection.

Definition at line 551 of file ConverterCollection.cs.

552  {
553  if(converterDelegate == null)
554  {
555  throw new ConverterCollectionException(ConverterCollectionCause.ConverterArgumentNull, $"{nameof(converterDelegate)} must not be null and of Type Delegate");
556  }
557  if((converterDelegate is Delegate) == false)
558  {
559  throw new ConverterCollectionException(ConverterCollectionCause.ConverterArgumentWrongType, $"{nameof(converterDelegate)} must be a `Delegate` Type");
560  }
561 
562  if(baseType == null)
563  {
564  baseType = ((Delegate)converterDelegate).Target.GetType().DeclaringType;
565  }
566 
567  var methodInfo = ((Delegate)converterDelegate).GetMethodInfo(); //type.GetDeclaredMethod("Invoke");
568  return this.Add(methodInfo: methodInfo, converterDelegate: converterDelegate, baseType: baseType, cancellationToken: cancellationToken);
569  }
IConverterCollection Add(object converterDelegate, Type baseType=null, CancellationToken cancellationToken=default(CancellationToken))
Initializes a new instance of the ConverterCollection class with default-parameters.
ConverterCollectionCause
Contains the reasons for a ConverterCollectionException to be raised.
IConverterCollection Core.TypeCast.ConverterCollection.Add ( MethodInfo  methodInfo,
object  converterDelegate = null,
Type  baseType = null,
object  baseInstance = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)

Creates and adds a Converter instance to the collection of ConverterCollection.Items using a MethodInfo instance

Parameters
methodInfoA MethodInfo instance describing a method to create a delegate from and add to the converter
converterDelegateAn optional function delegate to use as the Converter.Function
baseTypeThe Type of the declaring and attributed custom converter class, if one exists
baseInstanceAn optional base-class instance containing a method which is added to the converter and seves as this reference during invocation.
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterExceptionThrows an exception if adding failed

Definition at line 581 of file ConverterCollection.cs.

583  {
584 
585  var converter = this.Factory.Create(methodInfo, converterDelegate);
586 
587  if(converter != null)
588  {
589  converter.Base = baseInstance;
590  return this.Add(converter: converter, baseType: baseType, cancellationToken: cancellationToken);
591  }
592  else
593  {
594  throw new ConverterException(ConverterCause.ConverterCollectionAddFailed);
595  }
596  }
IConverterCollection Add(object converterDelegate, Type baseType=null, CancellationToken cancellationToken=default(CancellationToken))
Initializes a new instance of the ConverterCollection class with default-parameters.
ConverterCause
Contains the reasons for a ConverterException to be raised.

+ Here is the call graph for this function:

IConverterCollection Core.TypeCast.ConverterCollection.Add ( Converter  converter,
Type  baseType = null,
bool  allowDisambiguates = false,
CancellationToken  cancellationToken = default(CancellationToken) 
)

Adds a Converter instance to the collection of ConverterCollection.Items

Parameters
converterThe Converter instance to add to the ConverterCollection.Items
baseTypeThe Type of the declaring and attributed custom converter class, if one exists
allowDisambiguatesOptional bool value to indicate whether to allow multiple converters with the same return and parameter Types in the collection of Items. Only set to true for transform functions.
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterCollectionExceptionThrows an exception if adding failed

Implements Core.TypeCast.IConverterCollection.

Definition at line 609 of file ConverterCollection.cs.

610  {
611  if(converter == null)
612  {
613  throw new ConverterCollectionException(ConverterCollectionCause.ConverterArgumentNull);
614  }
615 
616  if(converter.HasFunction == false)
617  {
618  throw new ConverterCollectionException(ConverterCollectionCause.ConverterFunctionsNull);
619  }
620 
621  try
622  {
623  converter.SetCollectionDefaults(this);
624 
625  if(allowDisambiguates == false && baseType?.GetTypeInfo().BaseType == typeof(MulticastDelegate))
626  {
627  allowDisambiguates = true;
628  }
629 
630  converter.AllowDisambiguates = allowDisambiguates;
631  // if there is already a standard converter try to merge them. The condition is that the converter argument type match or is not used
632  if(allowDisambiguates == false && converter.Standard)
633  {
634  var converterLookup = this.Get(typeFrom: converter.From, typeTo: converter.To, typeArgument: typeof(object).GetTypeInfo(), loadOnDemand: false, isStandard: true);
635  try
636  {
637  if(converterLookup?.MergeStandard(converter) == true)
638  {
639  return this;
640  }
641  }
642  catch(ConverterCollectionException exc)
643  {
644  exc.Cause |= ConverterCollectionCause.AddFailed;
645  throw exc;
646  }
647  }
648  // update the base-type and thus the attribute access of the converter
649  converter.SetBaseType(baseType);
650 
651  this.Items.TryAdd(converter, 100, cancellationToken);
652  OnPropertyChanged(converter);
653  }
654  catch(ConverterCollectionException)
655  {
656  throw;
657  }
658  catch(ConverterException)
659  {
660  throw;
661  }
662  catch(Exception exc)
663  {
664  throw new ConverterException(ConverterCause.ConverterCollectionAddFailed, exc);
665  }
666 
667  return this;
668  }
BlockingCollection< Converter > Items
The BlockingCollection<Converter> class provides a thread-safe collection with full support of the Pr...
ConverterCollectionCause
Contains the reasons for a ConverterCollectionException to be raised.
ConverterCause
Contains the reasons for a ConverterException to be raised.
IConverterCollection Core.TypeCast.IConverterCollection.Add< TBase > ( object  converterDelegate,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inherited

Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate

Parameters
converterDelegateAn optional function delegate to use as the Converter.Function
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterExceptionThrows a ConverterCause.ConverterCollectionAddFailed with a wrapped Exception.InnerException if an internal error occurred
Type Constraints
TBase :class 
IConverterCollection Core.TypeCast.IConverterCollection.Add< TIn, TArg, TOut > ( Func< TIn, TArg, TOut >  converterActionAny,
Type  baseType = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inherited

Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate

Template Parameters
TInThe Source- / From- Typefrom which to Converter<TIn,TOut>.Convert(object,object)
TOutThe Target / To- Type to which to Converter<TIn,TOut>.Convert(object,object)
TArgThe Argument Type for generic converters using see ObjectExtension.ConvertTo<TIn, TOut>(TIn, object).
Parameters
converterActionAnyA function delegate Func<TIn, TArg, TOut> to use as the Converter.Function
baseTypeThe Type of the declaring and attributed custom converter class, if one exists
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterExceptionThrows a ConverterCause.ConverterCollectionAddFailed with a wrapped Exception.InnerException if an internal error occurred
IConverterCollection Core.TypeCast.IConverterCollection.Add< TIn, TOut > ( Func< TIn, TOut >  converterAction,
Type  baseType = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inherited

Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate

Template Parameters
TInThe Source- / From- Typefrom which to Converter<TIn,TOut>.Convert(object,object)
TOutThe Target / To- Type to which to Converter<TIn,TOut>.Convert(object,object)
Parameters
converterActionA function delegate Func<TIn, TOut> to use as the Converter.Function
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterExceptionThrows a ConverterCause.ConverterCollectionAddFailed with a wrapped Exception.InnerException if an internal error occurred
IConverterCollection Core.TypeCast.IConverterCollection.Add< TIn, TOut, TBase > ( Func< TIn, TOut >  converterAction,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inherited

Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate

Template Parameters
TInThe Source- / From- Typefrom which to Converter<TIn,TOut>.Convert(object,object)
TOutThe Target / To- Type to which to Converter<TIn,TOut>.Convert(object,object)
TBaseThe Type of the declaring and attributed custom converter class
Parameters
converterActionA function delegate Func<TIn, TOut> to use as the Converter.Function
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterExceptionThrows a ConverterCause.ConverterCollectionAddFailed with a wrapped Exception.InnerException if an internal error occurred
Type Constraints
TBase :class 
IConverterCollection Core.TypeCast.IConverterCollection.Add< TIn, TOut, TBase > ( Func< TIn, TOut, TOut >  converterAction,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inherited

Creates and adds a Converter instance to the collection of ConverterCollection.Items using a Delegate

Template Parameters
TInThe Source- / From- Typefrom which to Converter<TIn,TOut>.Convert(object,object)
TOutThe Target / To- Type to which to Converter<TIn,TOut>.Convert(object,object)
Parameters
converterActionDefaultA function delegate Func<TIn, TOut, TOut> to use as the Converter.Function
baseTypeThe Type of the declaring and attributed custom converter class, if one exists
cancellationTokenOptional token to propagate notification that operations should be canceled. From System.Threading.Tasks.
Returns
Returns a IConverterCollection for safe, constricted function chaining.
Exceptions
ConverterExceptionThrows a ConverterCause.ConverterCollectionAddFailed with a wrapped Exception.InnerException if an internal error occurred
Type Constraints
TBase :class 
static void Core.TypeCast.ConverterCollection.AutoInitialize ( )
static

Checks if the ConverterCollection is initialized. Attempts to initialize and load the user-assembly if ConverterCollection.Initialized is false

see also: http://stackoverflow.com/questions/35655726/system-reflection-assembly-does-not-contain-a-definition-for-getexecutingassemb/39192534#39192534

Exceptions
ConverterExceptionIf the Reflection required for the Initialization failed an exception is caused of exception-cause: ConverterCause.ConverterAutoInitializationFailed

Definition at line 776 of file ConverterCollection.cs.

777  {
778  // is the ConverterCollection Initialized?
779  if(AutoInitialized == false && CurrentInstance.Settings.AutoInitialize == true)
780  {
781  try
782  {
783  var getEntryAssembly = typeof(Assembly).GetRuntimeMethods().FirstOrDefault(m => m.Name.Equals("GetEntryAssembly"));
784  if(getEntryAssembly != null)
785  {
786  var assembly = getEntryAssembly.Invoke(null, null) as Assembly;
787  CurrentInstance.Initialize(assembly);
788  CurrentInstance.ApplicationNameSpace = assembly?.GetNamespacesByLevel(0)?.FirstOrDefault();
789  }
790  // set as initialized regardless of success, to run only once
791  AutoInitialized = true;
792  }
793  catch(Exception exc)
794  {
795  throw new ConverterException(ConverterCause.ConverterAutoInitializationFailed, exc);
796  }
797  }
798  }
ConverterCause
Contains the reasons for a ConverterException to be raised.
bool Core.TypeCast.ConverterCollection.CanConvertFrom ( Type  typeFrom)

Returns bool true if the ConverterCollection supports conversion for a given Type typeFrom , else false.

Parameters
typeFromThe source Type to look up in Items

The function is a wrapper for ConverterCollectionFilters.WithFrom(IQueryable<Converter>, TypeInfo).

Returns
true if the source Type is supported as source type by any converter in the ConverterCollection, else false

Definition at line 676 of file ConverterCollection.cs.

677  {
678  return this.WithFrom(typeFrom.GetTypeInfo()).FirstOrDefault() != null;
679  }

Returns bool true if the ConverterCollection supports conversion for a given Type typeFrom , else false.

Template Parameters
TInThe source Type to look up in Items

The function is a wrapper for ConverterCollectionFilters.WithFrom(IQueryable<Converter>, TypeInfo).

Returns
true if the source Type is supported as source type by any converter in the ConverterCollection, else false

Definition at line 687 of file ConverterCollection.cs.

688  {
689  return this.WithFrom(typeof(TIn).GetTypeInfo()).FirstOrDefault() != null;
690  }
bool Core.TypeCast.ConverterCollection.CanConvertTo ( Type  typeTo)

Returns bool true if the ConverterCollection supports conversion for a given Type typeTo , else false.

Parameters
typeToThe target Type to look up in Items

The function is a wrapper for ConverterCollectionFilters.WithTo(IQueryable<Converter>, TypeInfo).

Returns
true if the target Type is supported as source type by any converter in the ConverterCollection, else false

Definition at line 698 of file ConverterCollection.cs.

699  {
700  return this.WithTo(typeTo.GetTypeInfo()).FirstOrDefault() != null;
701  }

Returns bool true if the ConverterCollection supports conversion for a given Type typeTo , else false.

Template Parameters
TInThe target Type to look up in Items

The function is a wrapper for ConverterCollectionFilters.WithTo(IQueryable<Converter>, TypeInfo).

Returns
true if the target Type is supported as source type by any converter in the ConverterCollection, else false

Definition at line 709 of file ConverterCollection.cs.

710  {
711  return this.WithTo(typeof(TOut).GetTypeInfo()).FirstOrDefault() != null;
712  }
ConverterAttribute Core.TypeCast.ConverterCollection.ConverterAttributeFromIConverter ( TypeInfo  baseType,
ConverterAttribute  attribute = null,
bool  update = false 
)

Adds or updates an attribute for a Converter if it exists, dependent only on the source and target conversion types

Parameters
baseTypeThe Type of the declaring and attributed custom converter class Type if one exists
attributeThe ConverterAttribute of the converter-class that is to be updated
updateWhether to update an existing Converter.Attribute
Returns
Returns the updated attribute , if update was set to true

Definition at line 721 of file ConverterCollection.cs.

722  {
723  if(baseType == null || (attribute != null && update == false))
724  {
725  return attribute;
726  }
727 
728  attribute = attribute ?? new ConverterAttribute();
729 
730  attribute.BaseType = baseType;
731  // look up a possible converter candidate with generic IConverter<,> support
732  var converter = this.Get(baseType.AsType());
733  if(converter != null && (converter.Attribute == null || converter.Attribute != null && update == true))
734  {
735  converter.Attribute = attribute;
736  }
737 
738  return attribute;
739  }
override void Core.TypeCast.ConverterCollection.Dispose ( bool  disposing)
protected

Dispose of the Items and underlying static Singleton<TClass> references.

Parameters
disposingThe state of the object disposal, to avoid unnecessary invocations during the disposing invocation.

Invocation is only required in a few rare cases

warning CA2213 can be ignored: http://stackoverflow.com/questions/34583417/code-analysis-warning-ca2213-call-dispose-on-idisposable-backing-field

See also
Singleton<TClass>.Disposed

Definition at line 910 of file ConverterCollection.cs.

911  {
912  this.Items.Dispose();
913  base.Dispose(disposing);
914  }
BlockingCollection< Converter > Items
The BlockingCollection<Converter> class provides a thread-safe collection with full support of the Pr...
IEnumerator<Converter> Core.TypeCast.ConverterCollection.GetEnumerator ( )

Returns an enumerator that iterates through the collection.

Returns
A T:System.Collections.Generic.IEnumerator`1 that can be used to iterate through the collection.

Definition at line 1038 of file ConverterCollection.cs.

1039  {
1040  var enumerator = this.Items as IEnumerable<Converter>;//.GetConsumingEnumerable();
1041  return enumerator.GetEnumerator();
1042  }
BlockingCollection< Converter > Items
The BlockingCollection<Converter> class provides a thread-safe collection with full support of the Pr...
void Core.TypeCast.ConverterCollection.Initialize ( string  applicationNameSpace)

Initializes all attributed Converter classes, Initialize(Assembly[])

Parameters
applicationNameSpaceThe class that holds the entry point of the application. Usually public static Main(){...}

Example:

...
var ConverterManager = new ConverterManager();
ConverterManager.Initialize(typeof(Program));

Definition at line 813 of file ConverterCollection.cs.

814  {
815  IEnumerable<TypeInfo> types = Assembly.Load(new AssemblyName(applicationNameSpace)).DefinedTypes;
816  this.Initialize(types);
817  }
void Initialize(string applicationNameSpace)
Initializes all attributed Converter classes, Initialize(Assembly[])
void Core.TypeCast.ConverterCollection.Initialize ( Type  applicationClass)

Initializes all attributed Converter classes, Initialize(Assembly[])

Parameters
applicationClassThe class that holds the entry point of the application. Usually public static Main(){...}

Example:

...
var ConverterManager = new ConverterManager();
ConverterManager.Initialize(typeof(Program));

Definition at line 832 of file ConverterCollection.cs.

833  {
834  if(applicationClass != null)
835  {
836  var assembly = applicationClass.GetTypeInfo().Assembly;
837  this.Initialize(new[] { assembly });
838  }
839  }
void Initialize(string applicationNameSpace)
Initializes all attributed Converter classes, Initialize(Assembly[])
void Core.TypeCast.ConverterCollection.Initialize ( Assembly  assembly)

Initializes all attributed Converter classes, Initialize(Assembly[])

Parameters
assemblyThe Assembly to look for attributed Converter classes

Example:

...
var ConverterManager = new ConverterManager();
ConverterManager.Initialize(typeof(Program).Assembly);

Definition at line 852 of file ConverterCollection.cs.

853  {
854  this.Initialize(new[] { assembly });
855  }
void Initialize(string applicationNameSpace)
Initializes all attributed Converter classes, Initialize(Assembly[])
void Core.TypeCast.ConverterCollection.Initialize ( Assembly[]  assemblies)

Initializes all attributed Converter classes, unless the ConverterAttribute parameter ConverterAttribute.LoadOnDemand is false

Parameters
assembliesAn Array of Assembly to look for ConverterAttribute to discover and add converters into the collection

Example:

...
var ConverterManager = new ConverterManager();
ConverterManager.Initialize(AppDomain.CurrentDomain.GetAssemblies());

Definition at line 869 of file ConverterCollection.cs.

870  {
871  foreach(var assembly in assemblies)
872  {
873  if(assembly == null || this.AssemblyInitialized.ContainsKey(assembly) == true)
874  {
875  continue;
876  }
877 
878  var types = assembly.GetAtributedTypes<ConverterAttribute>().ToArray();
879  this.Initialize(types);
880  }
881  }
void Initialize(string applicationNameSpace)
Initializes all attributed Converter classes, Initialize(Assembly[])
ConcurrentDictionary< Assembly, bool > AssemblyInitialized
Sets the Assembly as initialized in AssemblyInitialized
void Core.TypeCast.ConverterCollection.Initialize ( IEnumerable< TypeInfo >  types)

Initializes all attributed Converter classes, unless the ConverterAttribute parameter ConverterAttribute.LoadOnDemand is false

Parameters
typesThe Array of Assembly within to look for attributed Converter classes

Example:

...
var ConverterManager = new ConverterManager();
ConverterManager.Initialize(AppDomain.CurrentDomain.GetAssemblies());

Definition at line 894 of file ConverterCollection.cs.

895  {
896  foreach(var type in types)
897  {
898  this.AddAllConvertersByAttribute(type);
899  }
900  }
int Core.TypeCast.ConverterCollection.LoadOnDemandConverter ( Type  typeTo)

Tries to lookup the namespace obtained from typeTo in loadOnDemandConverters and add the converters. If successful the number of Added Converters are returned, and the NameSpace is removed from the list of loadOnDemandConverters.

Parameters
typeToThe converter target Type to obtain the namespace from.

Any compatible Converter.Standard converters will have merged after loading, as such the returned number of loaded converters does not have a direct relationship to the Count

Returns
Returns bool an integer number > 0 if the Converters of the namespace from typeTo were successfully added, otherwise returns 0

Definition at line 750 of file ConverterCollection.cs.

751  {
752  var nameSpace = typeTo?.Namespace.Split('.').Last();
753  if(nameSpace != null && this.loadOnDemandConverters.ContainsKey(nameSpace))
754  {
755  var loaded = this.loadOnDemandConverters[nameSpace].Select(this.CreateConverterClassInstance).Count();
756  this.loadOnDemandConverters.Remove(nameSpace);
757  return loaded;
758  }
759  return 0;
760  }
bool Core.TypeCast.ConverterCollection.SetAssemblyInitialized ( TypeInfo  type)
protected

Sets the Assembly as initialized in AssemblyInitialized

Parameters
typeThe TypeInfo instance from which to lookup the TypeInfo.Assembly
Returns
Returns true if the concurrent dictionary update succeeded

Definition at line 921 of file ConverterCollection.cs.

922  {
923  return this.AssemblyInitialized.AddOrUpdate(type.Assembly, true, (oldkey, oldval) => true);
924  }
ConcurrentDictionary< Assembly, bool > AssemblyInitialized
Sets the Assembly as initialized in AssemblyInitialized
bool Core.TypeCast.ConverterCollection.SetConverterClassInitialized ( TypeInfo  converterClass)
protected

Sets the Converter of the ConverterCollection as initialized

Parameters
converterClassThe class instance of a custom converter implementation that is to be marked initialized
Returns
Returns true if the concurrent dictionary update succeeded

The class can support IConverter

Definition at line 932 of file ConverterCollection.cs.

933  {
934  return this.ConverterClassInitialized.AddOrUpdate(converterClass, true, (oldkey, oldval) => true);
935  }

Property Documentation

ConcurrentDictionary<Assembly, bool> Core.TypeCast.IConverterCollection.AssemblyInitialized
getinherited

Sets the Assembly as initialized in AssemblyInitialized

Parameters
typethe TypeInfo instance from which to lookup the TypeInfo.Assembly
Returns
Returns true if the concurrent dictionary update succeeded

Definition at line 25 of file IConverterCollection.cs.

int Core.TypeCast.IConverterCollection.Count
getinherited

Gets the count of singletons in the list.

Definition at line 34 of file IConverterCollection.cs.

BlockingCollection<Converter> Core.TypeCast.IConverterCollection.Items
getinherited

The BlockingCollection<Converter> class provides a thread-safe collection with full support of the Producer-Consumer pattern, to store a collection of Converter instances.

Definition at line 31 of file IConverterCollection.cs.

ConverterCollectionSettings Core.TypeCast.ConverterCollection.Settings
getset

The settings for the ConverterCollection.

Definition at line 44 of file ConverterCollection.cs.


The documentation for this class was generated from the following files: