diff options
Diffstat (limited to 'mcs/class/corlib/System.Reflection/Module.cs')
-rw-r--r-- | mcs/class/corlib/System.Reflection/Module.cs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/mcs/class/corlib/System.Reflection/Module.cs b/mcs/class/corlib/System.Reflection/Module.cs index 01dc55f9be6..876967a50c0 100644 --- a/mcs/class/corlib/System.Reflection/Module.cs +++ b/mcs/class/corlib/System.Reflection/Module.cs @@ -55,6 +55,11 @@ namespace System.Reflection { const BindingFlags defaultBindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance; + static Module () { + FilterTypeName = new TypeFilter (filter_by_type_name); + FilterTypeNameIgnoreCase = new TypeFilter (filter_by_type_name_ignore_case); + } + internal Module () { } ~Module () { @@ -206,7 +211,7 @@ namespace System.Reflection { public override string ToString () { - return "Reflection.Module: " + name; + return name; } // Mono Extension: returns the GUID of this module @@ -215,6 +220,22 @@ namespace System.Reflection { return new Guid (GetGuidInternal ()); } + private static bool filter_by_type_name (Type m, object filterCriteria) { + string s = (string)filterCriteria; + if (s.EndsWith ("*")) + return m.Name.StartsWith (s.Substring (0, s.Length - 1)); + else + return m.Name == s; + } + + private static bool filter_by_type_name_ignore_case (Type m, object filterCriteria) { + string s = (string)filterCriteria; + if (s.EndsWith ("*")) + return m.Name.ToLower ().StartsWith (s.Substring (0, s.Length - 1).ToLower ()); + else + return String.Compare (m.Name, s, true) == 0; + } + [MethodImplAttribute (MethodImplOptions.InternalCall)] private extern string GetGuidInternal (); |