Documentation
Table of Contents

Method Add

Namespace
IntentSharp.Mapping
Assembly
IntentSharp.dll

Add<TArg, TResult>(string, string, Func<TArg, TResult>)

Registers a converter of one argument: a step reads one source as TArg and writes the result.

public MappingConverterRegistry Add<TArg, TResult>(string name, string version, Func<TArg, TResult> convert)

Parameters

name string

The name a step uses; unique in the registry, ignoring case.

version string

The converter's version; change it when the converter's meaning changes.

convert Func<TArg, TResult>

The conversion. It is not called for a null source.

Returns

MappingConverterRegistry

This registry, for chaining.

Type Parameters

TArg

The argument type: a string, a number, bool, a date or time, Guid, Uri, an enum, an object or a list of these.

TResult

The result type, of the same kinds.

Exceptions

ArgumentNullException

convert is null.

ArgumentException

The name or version is null, empty or white space, the name is registered already, or a type is not one a mapping can read or write.

Add<TArg1, TArg2, TResult>(string, string, Func<TArg1, TArg2, TResult>)

Registers a converter of two arguments: a step reads two sources, in order, as TArg1 and TArg2.

public MappingConverterRegistry Add<TArg1, TArg2, TResult>(string name, string version, Func<TArg1, TArg2, TResult> convert)

Parameters

name string

The name a step uses; unique in the registry, ignoring case.

version string

The converter's version; change it when the converter's meaning changes.

convert Func<TArg1, TArg2, TResult>

The conversion. It is not called when either source is null.

Returns

MappingConverterRegistry

This registry, for chaining.

Type Parameters

TArg1

The first argument type.

TArg2

The second argument type.

TResult

The result type.

Exceptions

ArgumentNullException

convert is null.

ArgumentException

The name or version is null, empty or white space, the name is registered already, or a type is not one a mapping can read or write.