C
Carl Rosenberger
Hi all,
our C# object database engine is using the
System.Object.GetHashCode() method to manage
references to instantiated objects.
Our port to the CompactFramework is just about
completed except for one remaining problem:
If user classes override the GetHashCode() method,
our reference system will fail.
On the 1.0 .NET framework it was possible to use
reflection to achieve the desired result:
(typeof(System.Object)).GetMethod("GetHashCode").Invoke(obj, null);
We observe that the behaviour of reflection has changed
with .NET 1.1 and virtual methods (the overriden ones)
are called. The same appears to happen on the CompactFramework.
Are there any other MS platforms with different behaviour that
we need to be aware of?
On the regular 1.1 framework we can use:
System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(ob);
This method is not available on the CompactFramework.
What other options do we have?
Is there an alternative method anywhere?
Can we maybe include some IL code with our build to call
System.Object.GetHashCode() ?
How would we do this?
Thanks in advance for any hints.
Kind regards,
Carl
our C# object database engine is using the
System.Object.GetHashCode() method to manage
references to instantiated objects.
Our port to the CompactFramework is just about
completed except for one remaining problem:
If user classes override the GetHashCode() method,
our reference system will fail.
On the 1.0 .NET framework it was possible to use
reflection to achieve the desired result:
(typeof(System.Object)).GetMethod("GetHashCode").Invoke(obj, null);
We observe that the behaviour of reflection has changed
with .NET 1.1 and virtual methods (the overriden ones)
are called. The same appears to happen on the CompactFramework.
Are there any other MS platforms with different behaviour that
we need to be aware of?
On the regular 1.1 framework we can use:
System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(ob);
This method is not available on the CompactFramework.
What other options do we have?
Is there an alternative method anywhere?
Can we maybe include some IL code with our build to call
System.Object.GetHashCode() ?
How would we do this?
Thanks in advance for any hints.
Kind regards,
Carl