-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathObjectToCode.cs
More file actions
29 lines (22 loc) · 1.65 KB
/
Copy pathObjectToCode.cs
File metadata and controls
29 lines (22 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
namespace ExpressionToCodeLib;
/// <summary>
/// If you wish to override some formatting aspects of these methods, set
/// ExpressionToCodeConfiguration.GlobalCodeGetConfiguration.
/// </summary>
public static class ObjectToCode
{
public static string ComplexObjectToPseudoCode(object? val)
=> ObjectToCodeImpl.ComplexObjectToPseudoCode(ExpressionToCodeConfiguration.GlobalCodeGenConfiguration, val, 0);
public static string ComplexObjectToPseudoCode(this ExpressionToCodeConfiguration config, object? val)
=> ObjectToCodeImpl.ComplexObjectToPseudoCode(config, val, 0);
public static string? PlainObjectToCode(object? val)
=> ObjectToCodeImpl.PlainObjectToCode(ExpressionToCodeConfiguration.GlobalCodeGenConfiguration, val, val?.GetType());
public static string? PlainObjectToCode(object? val, Type? type)
=> ObjectToCodeImpl.PlainObjectToCode(ExpressionToCodeConfiguration.GlobalCodeGenConfiguration, val, type);
public static string ToCSharpFriendlyTypeName(this Type type)
=> ExpressionToCodeConfiguration.GlobalCodeGenConfiguration.GetTypeToCode(true).GetTypeName(type);
public static string ToCSharpFriendlyTypeName(this Type type, ExpressionToCodeConfiguration config, bool includeGenericTypeArgumentNames)
=> config.GetTypeToCode(includeGenericTypeArgumentNames).GetTypeName(type);
public static string ToCSharpFriendlyTypeName(this Type type, bool useFullyQualifiedTypeNames, bool includeGenericTypeArgumentNames)
=> new TypeToCodeConfig { IncludeGenericTypeArgumentNames = includeGenericTypeArgumentNames, UseFullyQualifiedTypeNames = useFullyQualifiedTypeNames, }.GetTypeName(type);
}