================================= Using Types in Configuration File ================================= Many configuration elements reference **C#** types. Either the full type name of the element should be specified using a type attribute (the attribute name might be different depending on element), or type alias should be specified, to reference a type declared in element under element **/iocConfiguration/typeDefinitions/typeDefinitions** (see below for more details). Some examples are: - - - If the element uses the full type name, an optional attribute **assembly** can be used to specify the assembly, where the type is. .. note:: Refer to :doc:`./assemblies-and-probing-paths` for more details on assemblies in configuration file. **IoC.Configuration** looks up the type in all the assemblies under element **/iocConfiguration/assemblies**. .. note:: Refer to :doc:`../sample-files/IoCConfiguration_GenericTypesAndTypeReUse.generated` for more examples of using types in configuration file. Generic Types in Configuration File =================================== To reference generic types, list the comma separated generic type parameters within opening and closing square brackets (i.e., []) after the type name. Some examples are: .. code-block:: xml .. code-block:: xml Array Types in Configuration File ================================= Array types can be specified by appending character **#** after the array item type name. Example is: .. code-block:: xml Re-Using Types ============== To avoid specifying the full type name in multiple elements in configuration file, we can define the type in **/iocConfiguration/typeDefinitions/typeDefinition** element, and reference the type using tye type alias in other elements. Here is an example of declaring a type **System.Collections.Generic.IEnumerable** with alias **IEnumerableOf_IInterface1** in **typeDefinition** element: .. code-block:: xml Here is an example of referencing the type with alias **IEnumerableOf_IInterface1** declared in **typeDefinition** element: .. code-block:: xml