Display Attributes
Maintenance: Community maintained; support is best-effort with no published response SLA.
Last verified published version: 1.0.12 on 2026-10-31 (NuGet Gallery).
Overview
VersaTul.Display.Attributes lets you annotate model properties with export metadata such as display name, ordering, numeric precision, date formatting, and ignore rules.
The package is most useful when paired with Collection Streamers, where those annotations influence the shape and formatting of exported output.
When To Use This Package
Use this package when you want to:
Rename columns during export without renaming your model properties.
Control export column order.
Round decimal values during output generation.
Format date values with a display-specific format string.
Exclude properties from exported output.
Package And Change History
VersaTul.Display.Attributes on NuGet VersaTul.Display.Attributes versions and release notes
Installation
Install the package with the .NET CLI:
dotnet add package VersaTul.Display.Attributes
Core Types And Concepts
DisplayAttributeAttribute used to control exported name, sequence, decimal precision, date formatting, culture, and ignore behavior.
IDisplayAnalyzerandDisplayAnalyzerRead display metadata from reflected properties and format values using registered formatters.
IFormatterFormatter contract used by the display pipeline.
DateFormatterandDecimalFormatterBuilt-in formatters for date and numeric output.
Key Capabilities
Override the exported property name with
Name.Control output order with
Sequence.Round numeric values with
Decimals.Format
DateTimevalues withDateFormattingStringand optionalCultureName.Exclude members from output with
Ignore.Register additional custom formatters through
DisplayAnalyzer.RegisterFormatter().
Attribute Example
using VersaTul.Display.Attributes;
public class Order
{
public int OrderId { get; set; }
[Display(Name = "Shipping Method", Sequence = 1)]
public string ShipVia { get; set; }
[Display(Decimals = 2, Sequence = 2)]
public decimal SubTotal { get; set; }
[Display(DateFormattingString = "D", Sequence = 3)]
public DateTime OrderDate { get; set; }
[Display(Ignore = true)]
public bool InternalFlag { get; set; }
}
Analyzer Example
var analyzer = new DisplayAnalyzer();
var property = typeof(Order).GetProperty(nameof(Order.OrderDate));
var display = analyzer.GetAttribute(property);
var formatted = analyzer.FormatValue(display, DateTime.UtcNow);
Member Identity And Concurrent Use
Metadata is cached by declaring type, module and member token. Inherited views reuse the declaring member, while constructed generic declaring types remain distinct. All display settings, including date format and culture, are preserved. Formatting receives a copy of cached settings so a custom formatter cannot alter metadata used by later calls.
Use the concrete analyzer’s member-aware method for precise formatting:
var property = typeof(Order).GetProperty(nameof(Order.SubTotal));
var formatted = analyzer.FormatPropertyValue(property, 12.345m);
The existing FormatValue(value, propertyName) method remains valid for a unique
registered member name. If different declaring members share that name, it now
throws InvalidOperationException instead of silently reusing the first
member’s metadata. Unknown names still throw KeyNotFoundException. This is a
Major release migration: use FormatPropertyValue(property, value) when member
names can be ambiguous. Existing IDisplayAnalyzer implementations do not need a
new member; interface callers can use
FormatValue(analyzer.GetAttribute(property), value).
Metadata caching, heading snapshots and formatter registration support concurrent use. Each operation captures a stable formatter snapshot, so registration during execution affects subsequent snapshots. Registered formatter instances may run concurrently and must synchronize their own mutable state. Built-in formatters keep per-operation state in PropertyData rather than on the formatter instance.
Notes
DisplayAnalyzer.PropertyNamesreturns resolved export names ordered by sequence and then name.The analyzer caches resolved property metadata internally as names are requested.
Custom formatters are the extension point when you need export-specific formatting beyond the built-ins.
Canonical package quickstart
Control exported property names, order, precision, date formats, culture, and ignored fields with attributes and configurable formatters.
Install the package in your application with the .NET CLI:
dotnet add package VersaTul.Display.Attributes
Minimal package example
This compiler-verified example is also used by the packed package README.
using VersaTul.Display.Attributes;
var property = typeof(Product).GetProperty(nameof(Product.Price))!;
var analyzer = new DisplayAnalyzer();
Console.WriteLine($"{analyzer.GetName(property)}: {analyzer.FormatPropertyValue(property, 19.999m)}");
sealed class Product
{
[Display(Name = "Unit price", Decimals = 2)]
public decimal Price { get; set; }
}
Expected output
Unit price: 20.00
Support
Generated API reference
The current published surface is VersaTul.Display.Attributes 1.0.12. This package’s links use that exact version; links to related packages use their independently listed release versions.
The matching DocsVersaTul snapshot is 2026.10.
Browse this package’s net8.0 API reference.
Key net8.0 API entries used by this package guide:
DisplayAttribute * DisplayAttribute.Name * DisplayAttribute.Ignore * DisplayAttribute.Sequence
IDisplayAnalyzer * IDisplayAnalyzer.RegisterFormatter * IDisplayAnalyzer.GetAttribute * IDisplayAnalyzer.FormatValue
DisplayAnalyzer * DisplayAnalyzer.RegisterFormatter * DisplayAnalyzer.GetAttribute * DisplayAnalyzer.FormatValue
Browse this package’s net9.0 API reference.
Key net9.0 API entries used by this package guide:
DisplayAttribute * DisplayAttribute.Name * DisplayAttribute.Ignore * DisplayAttribute.Sequence
IDisplayAnalyzer * IDisplayAnalyzer.RegisterFormatter * IDisplayAnalyzer.GetAttribute * IDisplayAnalyzer.FormatValue
DisplayAnalyzer * DisplayAnalyzer.RegisterFormatter * DisplayAnalyzer.GetAttribute * DisplayAnalyzer.FormatValue