.NET Portable TypeCast  3.1.0.4
A, easy-to-use tested, generic, portable, runtime-extensible, arbitrary type converter library
ConverterCollectionSettings.cs
Go to the documentation of this file.
1 // <copyright file=mitlicense.md url=http://lsauer.mit-license.org/ >
2 // Lo Sauer, 2013-2016
3 // </copyright>
4 // <summary> A tested, generic, portable, runtime-extensible type converter library </summary
5 // <language> C# > 6.0 </language>
6 // <version> 3.1.0.2 </version>
7 // <author> Lorenz Lo Sauer; people credited in the sources </author>
8 // <project> https://github.com/lsauer/dotnet-portable-type-cast </project>
9 namespace Core.TypeCast
10 {
11  using System;
12  using System.Globalization;
13 
14  using Core.TypeCast.Base;
15 
20  {
24  private bool converterDefaultWrapperOrException;
25 
29  private bool useFunctionDefaultWrapper;
30 
48  NumberFormatInfo numberFormat = null,
49  bool defaultValueAnyType = false,
50  bool useFunctionDefaultWrapper = true,
51  bool converterMissingException = false,
52  bool converterClassExistsException = false,
53  bool autoInitialize = true,
54  bool allowGenericTypes = true,
55  bool allowExplicitObject = true,
56  bool allowDynamicType = true,
57  bool converterDefaultWrapperOrException = true,
58  int boundedCapacity = 10000)
59  {
60  this.DefaultValueAnyType = defaultValueAnyType;
61  this.UseFunctionDefaultWrapper = useFunctionDefaultWrapper;
62  this.NumberFormat = numberFormat ?? DefaultNumberFormat;
63  this.ConverterMissingException = converterMissingException;
64  this.ConverterClassExistsException = converterClassExistsException;
65  this.AutoInitialize = autoInitialize;
66  this.AllowGenericTypes = allowGenericTypes;
67  this.AllowExplicitObject = allowExplicitObject;
68  this.AllowDynamicType = allowDynamicType;
69  this.ConverterDefaultWrapperOrException = converterDefaultWrapperOrException;
70  this.BoundedCapacity = boundedCapacity;
71  }
72 
76  public static NumberFormatInfo DefaultNumberFormat { get; set; } = new NumberFormatInfo { NumberGroupSeparator = ".", NumberDecimalDigits = 2 };
77 
81  public bool AllowGenericTypes { get; set; }
82 
86  public bool AllowExplicitObject { get; set; }
87 
93  public bool AllowDynamicType { get; set; }
94 
98  public bool AutoInitialize { get; set; }
99 
104  public int BoundedCapacity { get; set; }
105 
109  public bool ConverterDefaultWrapperOrException
110  {
111  get
112  {
113  return this.converterDefaultWrapperOrException;
114  }
115 
116  set
117  {
118  this.useFunctionDefaultWrapper = value;
119  this.converterDefaultWrapperOrException = !value;
120  }
121  }
122 
126  public bool ConverterMissingException { get; set; }
127 
131  public bool ConverterClassExistsException { get; set; }
132 
140  public bool DefaultValueAnyType { get; set; }
141 
145  public NumberFormatInfo NumberFormat { get; set; }
146 
150  public bool UseFunctionDefaultWrapper
151  {
152  get
153  {
154  return this.useFunctionDefaultWrapper;
155  }
156 
157  set
158  {
159  this.useFunctionDefaultWrapper = value;
160  this.converterDefaultWrapperOrException = !value;
161  }
162  }
163  }
164 }
ConverterCollectionSettings(NumberFormatInfo numberFormat=null, bool defaultValueAnyType=false, bool useFunctionDefaultWrapper=true, bool converterMissingException=false, bool converterClassExistsException=false, bool autoInitialize=true, bool allowGenericTypes=true, bool allowExplicitObject=true, bool allowDynamicType=true, bool converterDefaultWrapperOrException=true, int boundedCapacity=10000)
Initializes a new instance of the ConverterCollectionSettings class.
The settings for the ConverterCollection.