Installation - axuno/SmartFormat GitHub Wiki
a) Available NuGet Packages
SmartFormat comes with the following packages:
- SmartFormat.NET - includes all SmartFormat extensions listed below.
- SmartFormat - The "Core" package
- SmartFormat.Extensions.Newtonsoft.Json - An
ISource
extension forNewtonsoft.Json
variables - SmartFormat.Extensions.System.Text.Json - An
ISource
extension forSystem.Text.Json
variables - SmartFormat.Extensions.Time - The formatter for
DateTime
,DateTimeOffset
andTimeSpan
variables - SmartFormat.Extensions.Xml - Brings the
ISource
extension forXElement
variables, and a formatter forXElement
s
c) The 'SmartFormat' NuGet Package
SmartFormat is the core package. It comes with the most frequently used extensions built-in:
i. Source extensions:
GlobalVariablesSource
PersistentVariablesSource
StringSource
✔️ListFormatter
(implementingISource
) ✔️DictionarySource
✔️ValueTupleSource
✔️ReflectionSource
✔️DefaultSource
✔️KeyValuePairSource
✔️
ii. Formatter extensions:
ListFormatter
(implementingIFormatter
) ✔️PluralLocalizationFormatter
✔️ConditionalFormatter
✔️IsMatchFormatter
✔️NullFormatter
✔️LocalizationFormatter
TemplateFormatter
ChooseFormatter
✔️SubStringFormatter
✔️DefaultFormatter
✔️
Note: Extensions marked (✔️) are included when calling Smart.CreateDefaultFormatter(...)
and also when using Smart.Format(...)
.
Some extensions (like PersistentVariablesSource
and TemplateFormatter
) require configuration to be useful.