mirror of
https://github.com/krahets/hello-algo.git
synced 2026-06-15 22:57:48 +08:00
* Add Russian docs site baseline * Add Russian localized codebase * Polish Russian code wording * Update ru code translation. * Update code translation and chapter covers. * Fix pythontutor extraction. * Add README and landing page. * placeholder of profiles * Use figures of English version * Remove chapter paperbook
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
/**
|
||
* File: built_in_hash.cs
|
||
* Created Time: 2023-06-26
|
||
* Author: hpstory (hpstory1024@163.com)
|
||
*/
|
||
|
||
namespace hello_algo.chapter_hashing;
|
||
|
||
public class built_in_hash {
|
||
[Test]
|
||
public void Test() {
|
||
int num = 3;
|
||
int hashNum = num.GetHashCode();
|
||
Console.WriteLine("Хеш-значение целого числа " + num + " = " + hashNum);
|
||
|
||
bool bol = true;
|
||
int hashBol = bol.GetHashCode();
|
||
Console.WriteLine("Хеш-значение булева значения " + bol + " = " + hashBol);
|
||
|
||
double dec = 3.14159;
|
||
int hashDec = dec.GetHashCode();
|
||
Console.WriteLine("Хеш-значение десятичного числа " + dec + " = " + hashDec);
|
||
|
||
string str = "Hello Algo";
|
||
int hashStr = str.GetHashCode();
|
||
Console.WriteLine("Хеш-значение строки " + str + " = " + hashStr);
|
||
|
||
object[] arr = [12836, "Сяо Ха"];
|
||
int hashTup = arr.GetHashCode();
|
||
Console.WriteLine("Хеш-значение массива [" + string.Join(", ", arr) + "] = " + hashTup);
|
||
|
||
ListNode obj = new(0);
|
||
int hashObj = obj.GetHashCode();
|
||
Console.WriteLine("Хеш-значение объекта узла " + obj + " = " + hashObj);
|
||
}
|
||
}
|