@@ -32,39 +32,39 @@ private static bool GetDescription<TClass, TProp>(Expression<Func<TClass, TProp>
32
32
return hasDescription ;
33
33
}
34
34
35
- private static ( TProp value , string firstLeader ) GetValue < TClass , TProp > ( TClass @class , Expression < Func < TClass , TProp > > propertySelector )
35
+ private static ( TProp value , string firstLeader ) GetValue < TClass , TProp > ( TClass targetClass , Expression < Func < TClass , TProp > > propertySelector )
36
36
{
37
- var value = propertySelector . Compile ( ) ( @class ) ;
37
+ var value = propertySelector . Compile ( ) ( targetClass ) ;
38
38
// https://stackoverflow.com/a/7580347/294804
39
39
var firstLeader = value != null ? String . Empty : CommentPrefix ;
40
40
var hasDisplayName = TryGetPropertyAttributeValue < TClass , TProp , DisplayNameAttribute , string > ( propertySelector , attr => attr . DisplayName , out var displayName ) ;
41
41
return ( value , $ "{ firstLeader } { ( hasDisplayName ? $ "{ displayName } { NameValueDelimiter } " : String . Empty ) } ") ;
42
42
}
43
43
44
44
// https://blogs.msdn.microsoft.com/csharpfaq/2010/03/11/how-can-i-get-objects-and-property-values-from-expression-trees/
45
- public static IEnumerable < string > ToDefinitionEntry < TClass , TProp > ( this TClass @class , Expression < Func < TClass , TProp > > propertySelector )
45
+ public static IEnumerable < string > ToDefinitionEntry < TClass , TProp > ( this TClass targetClass , Expression < Func < TClass , TProp > > propertySelector )
46
46
{
47
47
if ( GetDescription ( propertySelector , out var description ) ) yield return description ;
48
- ( var value , var firstLeader ) = GetValue ( @class , propertySelector ) ;
48
+ ( var value , var firstLeader ) = GetValue ( targetClass , propertySelector ) ;
49
49
yield return $ "{ firstLeader } { CreateValue ( value , ElementPrefix , ElementPostfix ) } ";
50
50
yield return String . Empty ;
51
51
}
52
52
53
53
private static string CreateValue < TProp > ( TProp value , string valuePrefix , string valuePostfix ) =>
54
54
$ "{ valuePrefix } { ( value == null ? String . Empty : value . ToString ( ) ) } { valuePostfix } ";
55
55
56
- public static IEnumerable < string > ToDefinitionEntry < TClass > ( this TClass @class , Expression < Func < TClass , bool ? > > propertySelector )
56
+ public static IEnumerable < string > ToDefinitionEntry < TClass > ( this TClass targetClass , Expression < Func < TClass , bool ? > > propertySelector )
57
57
{
58
58
if ( GetDescription ( propertySelector , out var description ) ) yield return description ;
59
- ( var value , var firstLeader ) = GetValue ( @class , propertySelector ) ;
59
+ ( var value , var firstLeader ) = GetValue ( targetClass , propertySelector ) ;
60
60
var boolValue = value != null && value . Value ;
61
61
yield return $ "{ firstLeader } { ( boolValue ? "$true" : "$false" ) } ";
62
62
yield return String . Empty ;
63
63
}
64
64
65
- public static IEnumerable < string > ToDefinitionEntry < TClass > ( this TClass @class , Expression < Func < TClass , PsDefinitionHeader > > propertySelector )
65
+ public static IEnumerable < string > ToDefinitionEntry < TClass > ( this TClass targetClass , Expression < Func < TClass , PsDefinitionHeader > > propertySelector )
66
66
{
67
- ( var header , var _ ) = GetValue ( @class , propertySelector ) ;
67
+ ( var header , var _ ) = GetValue ( targetClass , propertySelector ) ;
68
68
if ( header == null ) yield break ;
69
69
70
70
foreach ( var headerLine in header . ToDefinitionEntry ( ) )
@@ -88,10 +88,10 @@ public static IEnumerable<string> ToDefinitionEntry(this PsDefinition psDefiniti
88
88
yield return String . Empty ;
89
89
}
90
90
91
- public static IEnumerable < string > ToDefinitionEntry < TClass , TList > ( this TClass @class , Expression < Func < TClass , List < TList > > > propertySelector )
91
+ public static IEnumerable < string > ToDefinitionEntry < TClass , TList > ( this TClass targetClass , Expression < Func < TClass , List < TList > > > propertySelector )
92
92
{
93
93
if ( GetDescription ( propertySelector , out var description ) ) yield return description ;
94
- ( var values , var firstLeader ) = GetValue ( @class , propertySelector ) ;
94
+ ( var values , var firstLeader ) = GetValue ( targetClass , propertySelector ) ;
95
95
96
96
var isStringList = typeof ( TList ) == typeof ( string ) ;
97
97
var listPrefix = isStringList ? String . Empty : ObjectListPrefix ;
0 commit comments