Skip to content

Latest commit

 

History

History
89 lines (58 loc) · 3.02 KB

WithoutHaste.DataFiles.DotNet.DotNetSettings.md

File metadata and controls

89 lines (58 loc) · 3.02 KB

Static
Inheritance: object

Global settings for the entire DotNet namespace.

Fields

AdditionalQualifiedNameConverter

static Func<string,int,string>

A second level QualifiedNameConverter to provide further processing.
This method will be run after QualifiedNameConverter for each DotNetQualifiedName.

Set to null to not use any converter.

Remarks:
Setting always defaults to null.
With target frameworks 3.5 or higher, you can change this setting.

Example A:

DotNetSettings.QualifiedNameConverter = DotNetSettings.DefaultQualifiedNameConverter;
DotNetSettings.AdditionalQualifiedNameConverter = myCustomConverter;
string displayString = myQualifiedTypeName.FullName;

QualifiedNameConverter

static Func<string,int,string>

When DotNetQualifiedNames are converted to strings, this converter will be automatically applied to each:

  • generic type parameter
  • method parameter
  • type name

Set to null to not use any converter.

Remarks:
Setting always defaults to DefaultQualifiedNameConverter(string, int).
With target frameworks 3.5 or higher, you can change this setting.

See DefaultQualifiedNameConverter(string, int) for usage examples.

Example A:

DotNetSettings.QualifiedNameConverter = DotNetSettings.DefaultQualifiedNameConverter;
string displayString = myQualifiedTypeName.FullName;

Static Methods

DefaultQualifiedNameConverter(string fullName, int depth)

static string

Converts all standard .Net types to their common aliases.

Example A:

DotNetSettings.QualifiedNameConverter = DotNetSettings.DefaultQualifiedNameConverter;
string displayString = myQualifiedTypeName.FullName;

Example B:

"System.Int32" => "int"
"System.Collections.Generic.List<System.Int32> => "System.Collections.Generic.List<int>"
"MyType.MyMethod(System.Int32)" => "MyType.MyMethod(int)"

Parameters:

  • string fullName: When processing name "System.Collections.Generic.List", fullName will be "System" then "System.Collections" then "System.Collections.Generic" then "System.Collections.Generic.List".
  • int depth: When processing name "System.Collections.Generic.List", depth will be 3 at "System", then 2 at "Collections", then 1 at "Generic", then 0 at "List".

UseDefaultQualifiedNameConverter(bool useDefault)

static void

Toggle the use of the DefaultQualifiedNameConverter on and off.

Remarks
Only available in target frameworks less than 3.5. For higher frameworks, set QualifiedNameConverter directly.