Questions tagged «hashcode»

20
GetHashCode ඉක්මවා යාම සඳහා හොඳම ඇල්ගොරිතම කුමක්ද?
.NET හි, මෙම GetHashCodeක්‍රමය .NET මූලික පන්ති පුස්තකාල පුරා බොහෝ ස්ථානවල භාවිතා වේ. එය නිසි ලෙස ක්‍රියාත්මක කිරීම විශේෂයෙන් වැදගත් වන්නේ එකතුවක ඇති අයිතම ඉක්මනින් සොයා ගැනීම හෝ සමානාත්මතාවය තීරණය කිරීමේදී ය. GetHashCodeමගේ අභිරුචි පංති සඳහා ක්‍රියාත්මක කරන්නේ කෙසේද යන්න පිළිබඳ සම්මත ඇල්ගොරිතමයක් හෝ හොඳම භාවිතයක් තිබේද?

14
සමානාත්මතා ක්‍රමය ඉක්මවා ගිය විට GetHashCode අභිබවා යාම වැදගත් වන්නේ ඇයි?
පහත පන්තිය ලබා දී ඇත public class Foo { public int FooId { get; set; } public string FooName { get; set; } public override bool Equals(object obj) { Foo fooItem = obj as Foo; if (fooItem == null) { return false; } return fooItem.FooId == this.FooId; } public override …
1458 c#  overriding  hashcode 

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.