Skip to content

Commit 3407eb5

Browse files
committed
Added IDefaultFormatProvider interface
1 parent 0e130fe commit 3407eb5

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel.DataAnnotations;
4+
using System.Linq;
5+
using System.Text;
6+
7+
namespace IGLib
8+
{
9+
10+
/// <summary>Provides the default format provider (object of type <see cref="IFormatProvider"/>)
11+
/// for cases where the format provider is not explicitly specified; e.g., in methods where
12+
/// <see cref="IFormatProvider"/> is a parameter, but is not provided by the caller (parameter
13+
/// is set to null).</summary>
14+
/// <remarks><para>Usage example:</para>
15+
/// <remarks>In constructors or methods that have <see cref="IFormatProvider"/> as parameter, also
16+
/// provide <see cref="IDefaultFormatProviderSelector?"/> as parameter, and default it to null.
17+
/// Then, within the constructor, check if fhe format provider parameter is null, and if yes,
18+
/// set it to what the default format provider selector's
19+
/// <see cref="DefaulltFormatProvider"/> returns. In applications, you can arrange for specific
20+
/// <see cref="IDefaultFormatProviderSelector"/> to be injected in all such constructors.</remarks>
21+
/// </remarks>
22+
public interface IDefaultFormatProviderSelector
23+
{
24+
25+
IFormatProvider DefaulltFormatProvider { get; }
26+
27+
}
28+
29+
30+
}

0 commit comments

Comments
 (0)