C# 属性

C# 抽象

C# 字符串

C# 泛型

C# 杂项

C# 新特性

C# GetHashCode() 获取哈希码字符串

C# GetHashCode() 方法用于获取此字符串的哈希码。它返回一个整数值。

签名

句法 (Syntax)

public override int GetHashCode()

参数

它不带任何参数(参数)。

返回

它返回字符串对象的哈希码。


C# String GetHashCode() 方法示例

例子 (Example)

using System;    
    public class StringExample    
    {    
        public static void Main(string[] args)    
        {    
          string s1 = "Hello C#";  
          Console.WriteLine(s1.GetHashCode());  
        }    
    }

输出:

718576468


  • 使用社交账号登录,本站支持
全部评论(0)