6d109a48 6fd2 aabc 7d86 6444cda119eb - akesseler/Plexdata.Utilities.Templates GitHub Wiki

Options.Maximum Property

Gets and sets the maximum length of the formatted result string.

Namespace: Plexdata.Utilities.Formatting
Assembly: Plexdata.Utilities.Templates (in Plexdata.Utilities.Templates.dll) Version: 1.0.0

Syntax

C#

public int Maximum { get; set; }

Property Value

Type: Int32
The maximum length of formatted strings.

Remarks

The maximum length of formatted result strings can be controlled by this property. But keep in mind, any value less than one or greater than MaxValue minus one will be treated as "unlimited".

Please pay attention, the value of this property should always be greater than three because of otherwise the truncation indicator (...) cannot be appended.

The default value is MaxValue.

Examples

Below an illustration of what happens if the maximum is set to a value within a range of [1...5].

for (Int32 maximum = 1; maximum <= 5; maximum++)
{
    Options options = new Options() { Maximum = maximum };

    String result = Template.Format(options, "format string", null);
}

// Maximum = 1 : Result = "f"
// Maximum = 2 : Result = "fo"
// Maximum = 3 : Result = "for"
// Maximum = 4 : Result = "f..."
// Maximum = 5 : Result = "fo..."

See Also

Reference

Options Class
Plexdata.Utilities.Formatting Namespace
Options.IsLimited

⚠️ **GitHub.com Fallback** ⚠️