@@ -23,13 +23,14 @@ namespace MongoDB.Driver.Linq.Linq3Implementation.Misc
23
23
internal static class StringMethod
24
24
{
25
25
// private static fields
26
- private static readonly MethodInfo __contains ;
27
- #if NETSTANDARD2_1_OR_GREATER
28
- private static readonly MethodInfo __containsWithComparisonType ;
29
- #endif
30
- private static readonly MethodInfo __endsWith ;
31
- private static readonly MethodInfo __endsWithWithComparisonType ;
32
- private static readonly MethodInfo __endsWithWithIgnoreCaseAndCulture ;
26
+ private static readonly MethodInfo __containsWithChar ;
27
+ private static readonly MethodInfo __containsWithCharAndComparisonType ;
28
+ private static readonly MethodInfo __containsWithString ;
29
+ private static readonly MethodInfo __containsWithStringAndComparisonType ;
30
+ private static readonly MethodInfo __endsWithWithChar ;
31
+ private static readonly MethodInfo __endsWithWithString ;
32
+ private static readonly MethodInfo __endsWithWithStringAndComparisonType ;
33
+ private static readonly MethodInfo __endsWithWithStringAndIgnoreCaseAndCulture ;
33
34
private static readonly MethodInfo __getChars ;
34
35
private static readonly MethodInfo __indexOfAny ;
35
36
private static readonly MethodInfo __indexOfAnyWithStartIndex ;
@@ -53,9 +54,10 @@ internal static class StringMethod
53
54
private static readonly MethodInfo __splitWithCharsAndOptions ;
54
55
private static readonly MethodInfo __splitWithStringsAndCountAndOptions ;
55
56
private static readonly MethodInfo __splitWithStringsAndOptions ;
56
- private static readonly MethodInfo __startsWith ;
57
- private static readonly MethodInfo __startsWithWithComparisonType ;
58
- private static readonly MethodInfo __startsWithWithIgnoreCaseAndCulture ;
57
+ private static readonly MethodInfo __startsWithWithChar ;
58
+ private static readonly MethodInfo __startsWithWithString ;
59
+ private static readonly MethodInfo __startsWithWithStringAndComparisonType ;
60
+ private static readonly MethodInfo __startsWithWithStringAndIgnoreCaseAndCulture ;
59
61
private static readonly MethodInfo __strLenBytes ;
60
62
private static readonly MethodInfo __substrBytes ;
61
63
private static readonly MethodInfo __substring ;
@@ -74,13 +76,24 @@ internal static class StringMethod
74
76
// static constructor
75
77
static StringMethod ( )
76
78
{
77
- __contains = ReflectionInfo . Method ( ( string s , string value ) => s . Contains ( value ) ) ;
78
79
#if NETSTANDARD2_1_OR_GREATER
79
- __containsWithComparisonType = ReflectionInfo . Method ( ( string s , string value , StringComparison comparisonType ) => s . Contains ( value , comparisonType ) ) ;
80
+ __containsWithChar = ReflectionInfo . Method ( ( string s , char value ) => s . Contains ( value ) ) ;
81
+ __containsWithCharAndComparisonType = ReflectionInfo . Method ( ( string s , char value , StringComparison comparisonType ) => s . Contains ( value , comparisonType ) ) ;
82
+ __containsWithStringAndComparisonType = ReflectionInfo . Method ( ( string s , string value , StringComparison comparisonType ) => s . Contains ( value , comparisonType ) ) ;
83
+ __endsWithWithChar = ReflectionInfo . Method ( ( string s , char value ) => s . EndsWith ( value ) ) ;
84
+ __startsWithWithChar = ReflectionInfo . Method ( ( string s , char value ) => s . StartsWith ( value ) ) ;
85
+ #else
86
+ __containsWithChar = null ;
87
+ __containsWithCharAndComparisonType = null ;
88
+ __containsWithStringAndComparisonType = null ;
89
+ __endsWithWithChar = null ;
90
+ __startsWithWithChar = null ;
80
91
#endif
81
- __endsWith = ReflectionInfo . Method ( ( string s , string value ) => s . EndsWith ( value ) ) ;
82
- __endsWithWithComparisonType = ReflectionInfo . Method ( ( string s , string value , StringComparison comparisonType ) => s . EndsWith ( value , comparisonType ) ) ;
83
- __endsWithWithIgnoreCaseAndCulture = ReflectionInfo . Method ( ( string s , string value , bool ignoreCase , CultureInfo culture ) => s . EndsWith ( value , ignoreCase , culture ) ) ;
92
+
93
+ __containsWithString = ReflectionInfo . Method ( ( string s , string value ) => s . Contains ( value ) ) ;
94
+ __endsWithWithString = ReflectionInfo . Method ( ( string s , string value ) => s . EndsWith ( value ) ) ;
95
+ __endsWithWithStringAndComparisonType = ReflectionInfo . Method ( ( string s , string value , StringComparison comparisonType ) => s . EndsWith ( value , comparisonType ) ) ;
96
+ __endsWithWithStringAndIgnoreCaseAndCulture = ReflectionInfo . Method ( ( string s , string value , bool ignoreCase , CultureInfo culture ) => s . EndsWith ( value , ignoreCase , culture ) ) ;
84
97
__getChars = ReflectionInfo . Method ( ( string s , int index ) => s [ index ] ) ;
85
98
__indexOfAny = ReflectionInfo . Method ( ( string s , char [ ] anyOf ) => s . IndexOfAny ( anyOf ) ) ;
86
99
__indexOfAnyWithStartIndex = ReflectionInfo . Method ( ( string s , char [ ] anyOf , int startIndex ) => s . IndexOfAny ( anyOf , startIndex ) ) ;
@@ -104,9 +117,9 @@ static StringMethod()
104
117
__splitWithCharsAndOptions = ReflectionInfo . Method ( ( string s , char [ ] separator , StringSplitOptions options ) => s . Split ( separator , options ) ) ;
105
118
__splitWithStringsAndCountAndOptions = ReflectionInfo . Method ( ( string s , string [ ] separator , int count , StringSplitOptions options ) => s . Split ( separator , count , options ) ) ;
106
119
__splitWithStringsAndOptions = ReflectionInfo . Method ( ( string s , string [ ] separator , StringSplitOptions options ) => s . Split ( separator , options ) ) ;
107
- __startsWith = ReflectionInfo . Method ( ( string s , string value ) => s . StartsWith ( value ) ) ;
108
- __startsWithWithComparisonType = ReflectionInfo . Method ( ( string s , string value , StringComparison comparisonType ) => s . StartsWith ( value , comparisonType ) ) ;
109
- __startsWithWithIgnoreCaseAndCulture = ReflectionInfo . Method ( ( string s , string value , bool ignoreCase , CultureInfo culture ) => s . StartsWith ( value , ignoreCase , culture ) ) ;
120
+ __startsWithWithString = ReflectionInfo . Method ( ( string s , string value ) => s . StartsWith ( value ) ) ;
121
+ __startsWithWithStringAndComparisonType = ReflectionInfo . Method ( ( string s , string value , StringComparison comparisonType ) => s . StartsWith ( value , comparisonType ) ) ;
122
+ __startsWithWithStringAndIgnoreCaseAndCulture = ReflectionInfo . Method ( ( string s , string value , bool ignoreCase , CultureInfo culture ) => s . StartsWith ( value , ignoreCase , culture ) ) ;
110
123
__strLenBytes = ReflectionInfo . Method ( ( string s ) => s . StrLenBytes ( ) ) ;
111
124
__substrBytes = ReflectionInfo . Method ( ( string s , int startIndex , int length ) => s . SubstrBytes ( startIndex , length ) ) ;
112
125
__substring = ReflectionInfo . Method ( ( string s , int startIndex ) => s . Substring ( startIndex ) ) ;
@@ -124,13 +137,14 @@ static StringMethod()
124
137
}
125
138
126
139
// public properties
127
- public static MethodInfo Contains => __contains ;
128
- #if NETSTANDARD2_1_OR_GREATER
129
- public static MethodInfo ContainsWithComparisonType => __containsWithComparisonType ;
130
- #endif
131
- public static MethodInfo EndsWith => __endsWith ;
132
- public static MethodInfo EndsWithWithComparisonType => __endsWithWithComparisonType ;
133
- public static MethodInfo EndsWithWithIgnoreCaseAndCulture => __endsWithWithIgnoreCaseAndCulture ;
140
+ public static MethodInfo ContainsWithChar => __containsWithChar ;
141
+ public static MethodInfo ContainsWithCharAndComparisonType => __containsWithCharAndComparisonType ;
142
+ public static MethodInfo ContainsWithString => __containsWithString ;
143
+ public static MethodInfo ContainsWithStringAndComparisonType => __containsWithStringAndComparisonType ;
144
+ public static MethodInfo EndsWithWithChar => __endsWithWithChar ;
145
+ public static MethodInfo EndsWithWithString => __endsWithWithString ;
146
+ public static MethodInfo EndsWithWithStringAndComparisonType => __endsWithWithStringAndComparisonType ;
147
+ public static MethodInfo EndsWithWithStringAndIgnoreCaseAndCulture => __endsWithWithStringAndIgnoreCaseAndCulture ;
134
148
public static MethodInfo GetChars => __getChars ;
135
149
public static MethodInfo IndexOfAny => __indexOfAny ;
136
150
public static MethodInfo IndexOfAnyWithStartIndex => __indexOfAnyWithStartIndex ;
@@ -154,11 +168,12 @@ static StringMethod()
154
168
public static MethodInfo SplitWithCharsAndOptions => __splitWithCharsAndOptions ;
155
169
public static MethodInfo SplitWithStringsAndCountAndOptions => __splitWithStringsAndCountAndOptions ;
156
170
public static MethodInfo SplitWithStringsAndOptions => __splitWithStringsAndOptions ;
157
- public static MethodInfo StartsWith => __startsWith ;
158
- public static MethodInfo StartsWithWithComparisonType => __startsWithWithComparisonType ;
171
+ public static MethodInfo StartsWithWithChar => __startsWithWithChar ;
172
+ public static MethodInfo StartsWithWithString => __startsWithWithString ;
173
+ public static MethodInfo StartsWithWithStringAndComparisonType => __startsWithWithStringAndComparisonType ;
174
+ public static MethodInfo StartsWithWithStringAndIgnoreCaseAndCulture => __startsWithWithStringAndIgnoreCaseAndCulture ;
159
175
public static MethodInfo StrLenBytes => __strLenBytes ;
160
176
public static MethodInfo SubstrBytes => __substrBytes ;
161
- public static MethodInfo StartsWithWithIgnoreCaseAndCulture => __startsWithWithIgnoreCaseAndCulture ;
162
177
public static MethodInfo Substring => __substring ;
163
178
public static MethodInfo SubstringWithLength => __substringWithLength ;
164
179
public static MethodInfo ToLower => __toLower ;
0 commit comments