@@ -19,6 +19,25 @@ public static bool ImplementsInterface(this IType type, Interface intf)
1919 ) ;
2020 }
2121
22+ [ Obsolete (
23+ "Either ImplementsInterface() without the useRegularExpressions parameter or ImplementsInterfaceMatching() should be used"
24+ ) ]
25+ public static bool ImplementsInterface (
26+ this IType type ,
27+ string pattern ,
28+ bool useRegularExpressions
29+ )
30+ {
31+ if ( type is GenericParameter )
32+ {
33+ return false ;
34+ }
35+
36+ return type . ImplementedInterfaces . Any ( implementedInterface =>
37+ implementedInterface . FullNameMatches ( pattern , useRegularExpressions )
38+ ) ;
39+ }
40+
2241 public static bool ImplementsInterface ( this IType type , string fullName )
2342 {
2443 if ( type is GenericParameter )
@@ -55,6 +74,26 @@ public static bool IsAssignableTo(this IType type, IType assignableToType)
5574 return type . GetAssignableTypes ( ) . Contains ( assignableToType ) ;
5675 }
5776
77+ [ Obsolete (
78+ "Either IsAssignableTo() without the useRegularExpressions parameter or IsAssignableToTypeMatching() should be used"
79+ ) ]
80+ public static bool IsAssignableTo (
81+ this IType type ,
82+ string pattern ,
83+ bool useRegularExpressions
84+ )
85+ {
86+ if ( type is GenericParameter genericParameter )
87+ {
88+ return genericParameter . TypeConstraints . All ( t =>
89+ t . IsAssignableTo ( pattern , useRegularExpressions )
90+ ) ;
91+ }
92+
93+ return type . GetAssignableTypes ( )
94+ . Any ( t => t . FullNameMatches ( pattern , useRegularExpressions ) ) ;
95+ }
96+
5897 public static bool IsAssignableTo ( this IType type , string fullName )
5998 {
6099 if ( type is GenericParameter genericParameter )
@@ -239,6 +278,18 @@ public static Attribute GetAttributeOfType(this IType type, Class attributeClass
239278 ) ;
240279 }
241280
281+ [ Obsolete (
282+ "Either ResidesInNamespace() without the useRegularExpressions parameter or ResidesInNamespaceMatching() should be used"
283+ ) ]
284+ public static bool ResidesInNamespace (
285+ this IType e ,
286+ string pattern ,
287+ bool useRegularExpressions
288+ )
289+ {
290+ return e . Namespace . FullNameMatches ( pattern , useRegularExpressions ) ;
291+ }
292+
242293 public static bool ResidesInNamespace ( this IType e , string fullName )
243294 {
244295 return e . Namespace . FullNameEquals ( fullName ) ;
@@ -249,6 +300,18 @@ public static bool ResidesInNamespaceMatching(this IType e, string pattern)
249300 return e . Namespace . FullNameMatches ( pattern ) ;
250301 }
251302
303+ [ Obsolete (
304+ "Either ResidesInAssembly() without the useRegularExpressions parameter or ResidesInAssemblyMatching() should be used"
305+ ) ]
306+ public static bool ResidesInAssembly (
307+ this IType e ,
308+ string pattern ,
309+ bool useRegularExpressions
310+ )
311+ {
312+ return e . Assembly . FullNameMatches ( pattern , useRegularExpressions ) ;
313+ }
314+
252315 public static bool ResidesInAssembly ( this IType e , string fullName )
253316 {
254317 return e . Assembly . FullNameEquals ( fullName ) ;
@@ -259,6 +322,21 @@ public static bool ResidesInAssemblyMatching(this IType e, string pattern)
259322 return e . Assembly . FullNameMatches ( pattern ) ;
260323 }
261324
325+ [ Obsolete (
326+ "Either IsDeclaredAsFieldIn() without the useRegularExpressions parameter or IsDeclaredAsFieldInTypeMatching() should be used"
327+ ) ]
328+ public static bool IsDeclaredAsFieldIn (
329+ this IType type ,
330+ string pattern ,
331+ bool useRegularExpressions
332+ )
333+ {
334+ return type . GetFieldTypeDependencies ( true )
335+ . Any ( dependency =>
336+ dependency . Target . FullNameMatches ( pattern , useRegularExpressions )
337+ ) ;
338+ }
339+
262340 public static bool IsDeclaredAsFieldIn ( this IType type , string fullName )
263341 {
264342 return type . GetFieldTypeDependencies ( true )
0 commit comments