Interface IObjectResolver
- Namespace
- CsvHelper
- Assembly
- CsvHelper.dll
Defines the functionality of a class that creates objects from a given type.
public interface IObjectResolver
Properties
CanResolve
A value indicating if the resolver is able to resolve the given type. True if the type can be resolved, otherwise false.
Func<Type, bool> CanResolve { get; }
Property Value
ResolveFunction
The function that creates an object from a given type.
Func<Type, object[], object> ResolveFunction { get; }
Property Value
UseFallback
A value indicating if the resolver's CanResolve returns false that an object will still be created using CsvHelper's object creation. True to fallback, otherwise false. Default value is true.
bool UseFallback { get; }
Property Value
Methods
Resolve(Type, params object[])
Creates an object from the given type using the ResolveFunction function. If CanResolve is false, the object will be created using CsvHelper's default object creation. If UseFallback is false, an exception is thrown.
object Resolve(Type type, params object[] constructorArgs)
Parameters
type
TypeThe type to create an instance from. The created object may not be the same type as the given type.
constructorArgs
object[]Constructor arguments used to create the type.
Returns
Resolve<T>(params object[])
Creates an object from the given type using the ResolveFunction function. If CanResolve is false, the object will be created using CsvHelper's default object creation. If UseFallback is false, an exception is thrown.
T Resolve<T>(params object[] constructorArgs)
Parameters
constructorArgs
object[]Constructor arguments used to create the type.
Returns
- T
Type Parameters
T
The type to create an instance from. The created object may not be the same type as the given type.