本文整理汇总了C#中System.IntPtr.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# IntPtr.GetHashCode方法的具体用法?C# IntPtr.GetHashCode怎么用?C# IntPtr.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IntPtr
的用法示例。
在下文中一共展示了IntPtr.GetHashCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: KillTimer
public static void KillTimer (IntPtr timerId)
{
Timer t = (Timer) TimerStore[timerId.GetHashCode()];
t.Stop ();
t.Elapsed -= new ElapsedEventHandler (InternalTimerElapsed);
t.Dispose ();
TimerStore.Remove (timerId.GetHashCode());
}
示例2: InitHash
private static uint InitHash(IntPtr handle, int hashsize, out uint seed, out uint incr)
{
uint num = (uint) (handle.GetHashCode() & 0x7fffffff);
seed = num;
incr = 1 + ((uint) (((seed >> 5) + 1) % (hashsize - 1)));
return num;
}
示例3: GetHashCodeRespectAllBits
public static void GetHashCodeRespectAllBits()
{
var ptr1 = new IntPtr(0x123456FFFFFFFF);
var ptr2 = new IntPtr(0x654321FFFFFFFF);
Assert.NotEqual(ptr1.GetHashCode(), ptr2.GetHashCode());
}
示例4: Equals
public static void Equals(IntPtr ptr1, object obj, bool expected)
{
if (obj is IntPtr)
{
IntPtr ptr2 = (IntPtr)obj;
Assert.Equal(expected, ptr1 == ptr2);
Assert.Equal(!expected, ptr1 != ptr2);
Assert.Equal(expected, ptr1.GetHashCode().Equals(ptr2.GetHashCode()));
}
Assert.Equal(expected, ptr1.Equals(obj));
Assert.Equal(ptr1.GetHashCode(), ptr1.GetHashCode());
}