.NET Portable TypeCast
3.1.0.4
A, easy-to-use tested, generic, portable, runtime-extensible, arbitrary type converter library
|
Use ConverterMethodAttribute to declare a method in an arbitrary class as a logical Converter function. The only restriction towards the attributed method is a maximum of two defined function parameters. This limitation is by design, to advocate the use of the single responsibility principle, and building complex converters out of smaller ones, as implemented by a different library. Take a look at the examples and documentation for more information. More...
Public Member Functions | |
ConverterMethodAttribute (bool isStatic=true, bool loadOnDemand=true, string name="", bool passInstance=false) | |
Initializes a new instance of the ConverterMethodAttribute class, to declare a custom Converter function More... | |
Properties | |
Type | BaseType [get, set] |
Gets or sets the base type. More... | |
Use ConverterMethodAttribute to declare a method in an arbitrary class as a logical Converter function. The only restriction towards the attributed method is a maximum of two defined function parameters. This limitation is by design, to advocate the use of the single responsibility principle, and building complex converters out of smaller ones, as implemented by a different library. Take a look at the examples and documentation for more information.
The attribute provides collective initialization through the ConverterCollection class.
Example: Declaring an arbitrary class method to be loaded and encapsulated into a converter instance
Reference:
,
Definition at line 57 of file ConverterMethodAttribute.cs.
Core.TypeCast.ConverterMethodAttribute.ConverterMethodAttribute | ( | bool | isStatic = true , |
bool | loadOnDemand = true , |
||
string | name = "" , |
||
bool | passInstance = false |
||
) |
Initializes a new instance of the ConverterMethodAttribute class, to declare a custom Converter function
loadOnDemand | Set to true to allow joint initialization by the lazy instancing of the ConverterCollection Core.Singleton |
isStatic | Set to true to invoke the method with this reference set to null, otherwise with an instance reference passed. Default is true . |
name | An alias as a string, ideally set via the nameof operator to identify among ambiguous converters. |
dependencyInjection | Whether the declaring converter class is instantiated via dependency Injection. |
Definition at line 68 of file ConverterMethodAttribute.cs.
|
getset |
Gets or sets the base type.
Definition at line 80 of file ConverterMethodAttribute.cs.