File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ details about the cause of the failure
3232- Indexers can now be used with interface objects
3333- Fixed a bug where indexers could not be used if they were inherited
3434- Made it possible to use ` __len__ ` also on ` ICollection<> ` interface objects
35+ - Made it possible to call ` ToString ` , ` GetHashCode ` , and ` GetType ` on inteface objects
3536
3637### Removed
3738
Original file line number Diff line number Diff line change @@ -341,6 +341,17 @@ private static ClassInfo GetClassInfo(Type type)
341341 }
342342 }
343343 }
344+
345+ // All interface implementations inherit from Object,
346+ // but GetMembers don't return them either.
347+ var objFlags = BindingFlags . Public | BindingFlags . Instance ;
348+ foreach ( var mi in typeof ( object ) . GetMembers ( objFlags ) )
349+ {
350+ if ( local [ mi . Name ] == null )
351+ {
352+ items . Add ( mi ) ;
353+ }
354+ }
344355 }
345356
346357 for ( i = 0 ; i < items . Count ; i ++ )
Original file line number Diff line number Diff line change @@ -136,3 +136,14 @@ def test_interface_collection_iteration():
136136 untyped_list .Add (elem )
137137 for e in untyped_list :
138138 assert type (e ).__name__ == "int"
139+
140+
141+ def test_methods_of_Object_are_available ():
142+ """Test calling methods inherited from Object"""
143+ import System
144+ clrVal = System .Int32 (100 )
145+ i = System .IComparable (clrVal )
146+ assert i .Equals (clrVal )
147+ assert clrVal .GetHashCode () == i .GetHashCode ()
148+ assert clrVal .GetType () == i .GetType ()
149+ assert clrVal .ToString () == i .ToString ()
You can’t perform that action at this time.
0 commit comments