-
-
Notifications
You must be signed in to change notification settings - Fork 106
Configuration
All configuration options are in namespace SmartFormat.Core.Settings.
All settings classes have extensive xml-doc for all members. Please use xml-doc for further reference.
The main configuration container is the class SmartSettings.
SmartFormatter and Parser have a constructor which takes SmartSettings as an argument. When using the parameterless constructors, SmartSettings with its default values will be implicitly created and applied.
Don't change settings after first usage.
After a "smart class" is instanciated withSmartSettings, consider the settings as immutable. Later changes to the settings may or may not take effect.
Reasoning: As long as we're supporting older .Net Frameworks, we can't implement C# 9 Init-Only properties.
// DO
var sf = new SmartFormatter(new SmartSettings { CaseSensitivity = CaseSensitivityType.CaseInsensitive });
// DO NOT
var sf = new SmartFormatter();
sf.Settings.CaseSensitivity = CaseSensitivityType.CaseInsensitive;SmartSettings have the following, most important public members. Mostly, the names are self-explanatory.
-
bool IsThreadSafeMode. Default:false -
bool StringFormatCompatibility. Default:false -
CaseSensitivityType CaseSensitivity. Default:CaseSensitive -
ParserSettings Parser-
ParseErrorAction ErrorAction. Default:ThrowError -
bool ConvertCharacterStringLiterals. Default:true -
bool ParseInputAsHtml. Default:false
-
-
FormatterSettings Formatter-
FormatErrorAction ErrorAction. Default:ThrowError -
char AlignmentFillCharacter. Default:' '
-
-
Localization Localization-
ILocalizationProvider? LocalizationProvider. Default:null
-
-
static PoolSettings Pooling-
bool IsPoolingEnabled. Default:true bool CheckReturnedObjectsExistInPool
-
-
ParseErrorActionThrowErrorOutputErrorInResultIgnoreMaintainTokens
-
FormatErrorActionThrowErrorOutputErrorInResultIgnoreMaintainTokens
-
CaseSensitivityTypeCaseSensitiveCaseInsensitive
- Syntax, Terminology
- Placeholders and Nesting
- string.Format Compatibility
- Character Literals in Format Strings
- HTML With CSS or JavaScript
- Data Source Extensions
- Default _ DefaultFormatter
- Lists _ ListFormatter
- Choose _ ChooseFormatter
- Condition _ ConditionalFormatter
- Null _ NullFormatter
- SubString _ SubStringFormatter
- RegEx _ IsMatchFormatter
- Pluralization _ PluralLocalizationFormatter
- Localization _ LocalizationFormatter
- Templates _ TemplateFormatter
- TimeSpan _ TimeFormatter
- XML _ XElementFormatter
- Extension Methods
- Home
- Common Pitfalls
- HTML with CSS or JavaScript
- Overview
- Main Features
- Formatters
- Extra Features
- Console and StringBuilder
- TemplateFormatter
- SmartSettings to control Smart.Format behavior
- Additional Info
- License
3.6