Decimal.GetHashCode メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Decimal.GetHashCode メソッドの意味・解説 

Decimal.GetHashCode メソッド

このインスタンスハッシュ コード返します

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

使用例使用例

GetHashCode メソッド使用して複数Decimal 値のハッシュ コード返すコード例次に示します

' Example of the Decimal.GetHashCode method. 
Imports System
Imports Microsoft.VisualBasic

Module DecimalGetHashCodeDemo
    
    ' Display the Decimal.GetHashCode argument and the result array.
    Sub ShowDecimalGetHashCode( Argument As
 Decimal )

        Dim hashCode As Integer
 = Argument.GetHashCode( )

        Console.WriteLine( "{0,31}{1,14}  0x{1:X8}",
 Argument, _
            hashCode )
    End Sub

    Sub Main( )
        Console.WriteLine( "This example of the "
 & _
            "Decimal.GetHashCode( ) method generates "
 & vbCrLf & _
            "the following output. It displays the hash code of
 " & _
            "the " & vbCrLf & "Decimal
 argument in decimal and " & _
            "hexadecimal." & vbCrLf )
        Console.WriteLine( "{0,31}{1,14}", "Argument",
 "Hash Code" )
        Console.WriteLine( "{0,31}{1,14}", "--------",
 "---------" )

        ' Generate hash codes for Decimal objects.
        ShowDecimalGetHashCode( 0D )
        ShowDecimalGetHashCode( 1D )
        ShowDecimalGetHashCode( _
            Decimal.Parse( "1.0000000000000000000000000000"
 ) )
        ShowDecimalGetHashCode( 100000000000000D )
        ShowDecimalGetHashCode( _
            Decimal.Parse( "100000000000000.00000000000000"
 ) )
        ShowDecimalGetHashCode( 10000000000000000000000000000D )
        ShowDecimalGetHashCode( 10000000000000000000000009999D )
        ShowDecimalGetHashCode( 10000000000000000004294967295D )
        ShowDecimalGetHashCode( 123456789D ) 
        ShowDecimalGetHashCode( 0.123456789D ) 
        ShowDecimalGetHashCode( 0.000000000123456789D ) 
        ShowDecimalGetHashCode( 0.000000000000000000123456789D ) 
        ShowDecimalGetHashCode( 4294967295D ) 
        ShowDecimalGetHashCode( 18446744073709551615D ) 
        ShowDecimalGetHashCode( Decimal.MaxValue ) 
        ShowDecimalGetHashCode( Decimal.MinValue ) 
        ShowDecimalGetHashCode( -7.9228162514264337593543950335D ) 
    End Sub
End Module 

' This example of the Decimal.GetHashCode( ) method generates
' the following output. It displays the hash code of the
' Decimal argument in decimal and hexadecimal.
' 
'                        Argument     Hash Code
'                        --------     ---------
'                               0             0  0x00000000
'                               1    1072693248  0x3FF00000
'  1.0000000000000000000000000000    1072693248  0x3FF00000
'                 100000000000000    1548139716  0x5C46BCC4
'  100000000000000.00000000000000    1548139716  0x5C46BCC4
'   10000000000000000000000000000    1793013094  0x6ADF3566
'   10000000000000000000000009999    1793013094  0x6ADF3566
'   10000000000000000004294967295    1793013094  0x6ADF3566
'                       123456789     362639156  0x159D6F34
'                     0.123456789     143063426  0x0886F982
'            0.000000000123456789    -667156908  0xD83BFE54
'   0.000000000000000000123456789    -261016360  0xF07134D8
'                      4294967295   -1106247681  0xBE0FFFFF
'            18446744073709551615    1139802112  0x43F00000
'   79228162514264337593543950335    1173356544  0x45F00000
'  -79228162514264337593543950335    -974127104  0xC5F00000
' -7.9228162514264337593543950335    2119160044  0x7E4FD0EC
// Example of the decimal.GetHashCode method. 
using System;

class DecimalGetHashCodeDemo
{
    // Display the decimal.GetHashCode argument and the result array.
    public static void ShowDecimalGetHashCode(
 decimal Argument )
    {
        int hashCode = Argument.GetHashCode( );

        Console.WriteLine( "{0,31}{1,14}  0x{1:X8}", 
            Argument, hashCode );
    }

    public static void Main(
 )
    {
        Console.WriteLine( "This example of the " +
            "decimal.GetHashCode( ) method generates \nthe " +
            "following output. It displays the hash code of the \n" +
            "decimal argument in decimal and hexadecimal.\n"
 );
        Console.WriteLine( "{0,31}{1,14}", "Argument", "Hash
 Code" );
        Console.WriteLine( "{0,31}{1,14}", "--------", "---------"
 );

        // Generate hash codes for decimal objects.
        ShowDecimalGetHashCode( 0M );
        ShowDecimalGetHashCode( 1M );
        ShowDecimalGetHashCode( 1.0000000000000000000000000000M );
        ShowDecimalGetHashCode( 100000000000000M );
        ShowDecimalGetHashCode( 100000000000000.00000000000000M );
        ShowDecimalGetHashCode( 10000000000000000000000000000M );
        ShowDecimalGetHashCode( 10000000000000000000000009999M );
        ShowDecimalGetHashCode( 10000000000000000004294967295M );
        ShowDecimalGetHashCode( 123456789M );
        ShowDecimalGetHashCode( 0.123456789M );
        ShowDecimalGetHashCode( 0.000000000123456789M );
        ShowDecimalGetHashCode( 0.000000000000000000123456789M );
        ShowDecimalGetHashCode( 4294967295M );
        ShowDecimalGetHashCode( 18446744073709551615M );
        ShowDecimalGetHashCode( decimal.MaxValue );
        ShowDecimalGetHashCode( decimal.MinValue );
        ShowDecimalGetHashCode( -7.9228162514264337593543950335M );
    }
}

/*
This example of the decimal.GetHashCode( ) method generates
the following output. It displays the hash code of the
decimal argument in decimal and hexadecimal.

                       Argument     Hash Code
                       --------     ---------
                              0             0  0x00000000
                              1    1072693248  0x3FF00000
 1.0000000000000000000000000000    1072693248  0x3FF00000
                100000000000000    1548139716  0x5C46BCC4
 100000000000000.00000000000000    1548139716  0x5C46BCC4
  10000000000000000000000000000    1793013094  0x6ADF3566
  10000000000000000000000009999    1793013094  0x6ADF3566
  10000000000000000004294967295    1793013094  0x6ADF3566
                      123456789     362639156  0x159D6F34
                    0.123456789     143063426  0x0886F982
           0.000000000123456789    -667156908  0xD83BFE54
  0.000000000000000000123456789    -261016360  0xF07134D8
                     4294967295   -1106247681  0xBE0FFFFF
           18446744073709551615    1139802112  0x43F00000
  79228162514264337593543950335    1173356544  0x45F00000
 -79228162514264337593543950335    -974127104  0xC5F00000
-7.9228162514264337593543950335    2119160044  0x7E4FD0EC
*/
// Example of the Decimal::GetHashCode method. 
using namespace System;

// Display the Decimal::GetHashCode argument and the result array.
void ShowDecimalGetHashCode( Decimal Argument )
{
   int hashCode = Argument.GetHashCode();
   Console::WriteLine( "{0,31}{1,14}  0x{1:X8}", Argument, hashCode );
}

int main()
{
   Console::WriteLine( "This example of the "
   "Decimal::GetHashCode( ) method generates \nthe "
   "following output. It displays the hash code of the \n"
   "Decimal argument in decimal and hexadecimal.\n"
 );
   Console::WriteLine( "{0,31}{1,14}", "Argument", "Hash
 Code" );
   Console::WriteLine( "{0,31}{1,14}", "--------", "---------"
 );
   
   // Generate hash codes for Decimal objects.
   ShowDecimalGetHashCode( Decimal(0) );
   ShowDecimalGetHashCode( Decimal(1) );
   ShowDecimalGetHashCode( Decimal::Parse( "1.0000000000000000000000000000"
 ) );
   ShowDecimalGetHashCode( Decimal::Parse( "100000000000000" ) );
   ShowDecimalGetHashCode( Decimal::Parse( "100000000000000.00000000000000"
 ) );
   ShowDecimalGetHashCode( Decimal::Parse( "10000000000000000000000000000"
 ) );
   ShowDecimalGetHashCode( Decimal::Parse( "10000000000000000000000009999"
 ) );
   ShowDecimalGetHashCode( Decimal::Parse( "10000000000000000004294967295"
 ) );
   ShowDecimalGetHashCode( Decimal::Parse( "123456789" ) );
   ShowDecimalGetHashCode( Decimal::Parse( "0.123456789" ) );
   ShowDecimalGetHashCode( Decimal::Parse( "0.000000000123456789" ) );
   ShowDecimalGetHashCode( Decimal::Parse( "0.000000000000000000123456789"
 ) );
   ShowDecimalGetHashCode( Decimal::Parse( "4294967295" ) );
   ShowDecimalGetHashCode( Decimal::Parse( "18446744073709551615" ) );
   ShowDecimalGetHashCode( Decimal::MaxValue );
   ShowDecimalGetHashCode( Decimal::MinValue );
   ShowDecimalGetHashCode( Decimal::Parse( "-7.9228162514264337593543950335"
 ) );
}

/*
This example of the Decimal::GetHashCode( ) method generates
the following output. It displays the hash code of the
Decimal argument in decimal and hexadecimal.

                       Argument     Hash Code
                       --------     ---------
                              0             0  0x00000000
                              1    1072693248  0x3FF00000
 1.0000000000000000000000000000    1072693248  0x3FF00000
                100000000000000    1548139716  0x5C46BCC4
 100000000000000.00000000000000    1548139716  0x5C46BCC4
  10000000000000000000000000000    1793013094  0x6ADF3566
  10000000000000000000000009999    1793013094  0x6ADF3566
  10000000000000000004294967295    1793013094  0x6ADF3566
                      123456789     362639156  0x159D6F34
                    0.123456789     143063426  0x0886F982
           0.000000000123456789    -667156908  0xD83BFE54
  0.000000000000000000123456789    -261016360  0xF07134D8
                     4294967295   -1106247681  0xBE0FFFFF
           18446744073709551615    1139802112  0x43F00000
  79228162514264337593543950335    1173356544  0x45F00000
 -79228162514264337593543950335    -974127104  0xC5F00000
-7.9228162514264337593543950335    2119160044  0x7E4FD0EC
*/
// Example of the decimal.GetHashCode method. 
import System.*;

class DecimalGetHashCodeDemo
{
    // Display the decimal.GetHashCode argument and the result array.
    public static void ShowDecimalGetHashCode(System.Decimal
 argument)
    {
        int hashCode = argument.GetHashCode();
        Console.WriteLine("{0,31}{1,14}  0x{2}", argument, ((Int32)hashCode)
,
            ((Int32)hashCode).ToString("X8"));
    } //ShowDecimalGetHashCode

    public static void main(String[]
 args)
    {
        Console.WriteLine("This example of the " 
            + "decimal.GetHashCode() method generates \nthe " 
            + "following output. It displays the hash code of the \n" 
            + "decimal argument in decimal and hexadecimal.\n");
        Console.WriteLine("{0,31}{1,14}", "argument", "Hash
 Code");
        Console.WriteLine("{0,31}{1,14}", "--------", "---------");

        // Generate hash codes for decimal objects.
        ShowDecimalGetHashCode(System.Convert.ToDecimal(0));
        ShowDecimalGetHashCode(System.Convert.ToDecimal(1));
        ShowDecimalGetHashCode(System.Convert.ToDecimal(
            1.0000000000000000000000000000));
        ShowDecimalGetHashCode(System.Convert.ToDecimal(100000000000000D));
        ShowDecimalGetHashCode(System.Convert.ToDecimal(
            100000000000000.00000000000000));
        ShowDecimalGetHashCode(System.Convert.ToDecimal(
            10000000000000000000000000000D));
        ShowDecimalGetHashCode(System.Convert.ToDecimal(
            10000000000000000000000009999D));
        ShowDecimalGetHashCode(System.Convert.ToDecimal(
            10000000000000000004294967295D));
        ShowDecimalGetHashCode(System.Convert.ToDecimal(123456789));
        ShowDecimalGetHashCode(System.Convert.ToDecimal(0.123456789));
        ShowDecimalGetHashCode(System.Convert.ToDecimal(0.000000000123456789));
        ShowDecimalGetHashCode(System.Convert.ToDecimal(
            0.000000000000000000123456789));
        ShowDecimalGetHashCode(System.Convert.ToDecimal(4294967295D));
        ShowDecimalGetHashCode(System.Convert.ToDecimal(
            18446744073709551615D));
        ShowDecimalGetHashCode(System.Decimal.MaxValue);
        ShowDecimalGetHashCode(System.Decimal.MinValue);
        ShowDecimalGetHashCode(System.Convert.ToDecimal(
            -7.9228162514264337593543950335));
    } //main
} //DecimalGetHashCodeDemo

/*
This example of the decimal.GetHashCode( ) method generates
the following output. It displays the hash code of the
decimal argument in decimal and hexadecimal.

                       argument     Hash Code
                       --------     ---------
                              0             0  0x00000000
                              1    1072693248  0x3FF00000
 1.0000000000000000000000000000    1072693248  0x3FF00000
                100000000000000    1548139716  0x5C46BCC4
 100000000000000.00000000000000    1548139716  0x5C46BCC4
  10000000000000000000000000000    1793013094  0x6ADF3566
  10000000000000000000000009999    1793013094  0x6ADF3566
  10000000000000000004294967295    1793013094  0x6ADF3566
                      123456789     362639156  0x159D6F34
                    0.123456789     143063426  0x0886F982
           0.000000000123456789    -667156908  0xD83BFE54
  0.000000000000000000123456789    -261016360  0xF07134D8
                     4294967295   -1106247681  0xBE0FFFFF
           18446744073709551615    1139802112  0x43F00000
  79228162514264337593543950335    1173356544  0x45F00000
 -79228162514264337593543950335    -974127104  0xC5F00000
-7.9228162514264337593543950335    2119160044  0x7E4FD0EC
*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からDecimal.GetHashCode メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDecimal.GetHashCode メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDecimal.GetHashCode メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Decimal.GetHashCode メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Decimal.GetHashCode メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS