Files
hello-algo/ja/codes/csharp/chapter_hashing/built_in_hash.cs
Yudong Jin 7257641e0e Retranslate the complete Japanese online edition from Chinese (#2008)
* Retranslate the complete Japanese online edition from Chinese

* Fit Japanese homepage labels and localize heading permalinks

* Point Japanese contribution instructions to the Japanese preview

* Replace locale conditionals with multilingual UI tables
2026-10-30 02:12:26 +08:00

37 lines
1.2 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 算法";
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);
}
}