@@ -23,13 +23,14 @@ namespace MongoDB.Driver.Linq.Linq3Implementation.Misc
2323 internal static class StringMethod
2424 {
2525 // 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 ;
3334 private static readonly MethodInfo __getChars ;
3435 private static readonly MethodInfo __indexOfAny ;
3536 private static readonly MethodInfo __indexOfAnyWithStartIndex ;
@@ -53,9 +54,10 @@ internal static class StringMethod
5354 private static readonly MethodInfo __splitWithCharsAndOptions ;
5455 private static readonly MethodInfo __splitWithStringsAndCountAndOptions ;
5556 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 ;
5961 private static readonly MethodInfo __strLenBytes ;
6062 private static readonly MethodInfo __substrBytes ;
6163 private static readonly MethodInfo __substring ;
@@ -74,13 +76,24 @@ internal static class StringMethod
7476 // static constructor
7577 static StringMethod ( )
7678 {
77- __contains = ReflectionInfo . Method ( ( string s , string value ) => s . Contains ( value ) ) ;
7879#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 ;
8091#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 ) ) ;
8497 __getChars = ReflectionInfo . Method ( ( string s , int index ) => s [ index ] ) ;
8598 __indexOfAny = ReflectionInfo . Method ( ( string s , char [ ] anyOf ) => s . IndexOfAny ( anyOf ) ) ;
8699 __indexOfAnyWithStartIndex = ReflectionInfo . Method ( ( string s , char [ ] anyOf , int startIndex ) => s . IndexOfAny ( anyOf , startIndex ) ) ;
@@ -104,9 +117,9 @@ static StringMethod()
104117 __splitWithCharsAndOptions = ReflectionInfo . Method ( ( string s , char [ ] separator , StringSplitOptions options ) => s . Split ( separator , options ) ) ;
105118 __splitWithStringsAndCountAndOptions = ReflectionInfo . Method ( ( string s , string [ ] separator , int count , StringSplitOptions options ) => s . Split ( separator , count , options ) ) ;
106119 __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 ) ) ;
110123 __strLenBytes = ReflectionInfo . Method ( ( string s ) => s . StrLenBytes ( ) ) ;
111124 __substrBytes = ReflectionInfo . Method ( ( string s , int startIndex , int length ) => s . SubstrBytes ( startIndex , length ) ) ;
112125 __substring = ReflectionInfo . Method ( ( string s , int startIndex ) => s . Substring ( startIndex ) ) ;
@@ -124,13 +137,14 @@ static StringMethod()
124137 }
125138
126139 // 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 ;
134148 public static MethodInfo GetChars => __getChars ;
135149 public static MethodInfo IndexOfAny => __indexOfAny ;
136150 public static MethodInfo IndexOfAnyWithStartIndex => __indexOfAnyWithStartIndex ;
@@ -154,11 +168,12 @@ static StringMethod()
154168 public static MethodInfo SplitWithCharsAndOptions => __splitWithCharsAndOptions ;
155169 public static MethodInfo SplitWithStringsAndCountAndOptions => __splitWithStringsAndCountAndOptions ;
156170 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 ;
159175 public static MethodInfo StrLenBytes => __strLenBytes ;
160176 public static MethodInfo SubstrBytes => __substrBytes ;
161- public static MethodInfo StartsWithWithIgnoreCaseAndCulture => __startsWithWithIgnoreCaseAndCulture ;
162177 public static MethodInfo Substring => __substring ;
163178 public static MethodInfo SubstringWithLength => __substringWithLength ;
164179 public static MethodInfo ToLower => __toLower ;
0 commit comments