NumberFormatInfo.NumberNegativePattern プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > NumberFormatInfo.NumberNegativePattern プロパティの意味・解説 

NumberFormatInfo.NumberNegativePattern プロパティ

負の数値の形式パターン取得または設定します

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

Public Property NumberNegativePattern As
 Integer
Dim instance As NumberFormatInfo
Dim value As Integer

value = instance.NumberNegativePattern

instance.NumberNegativePattern = value
public int NumberNegativePattern { get;
 set; }
public:
property int NumberNegativePattern {
    int get ();
    void set (int value);
}
/** @property */
public int get_NumberNegativePattern ()

/** @property */
public void set_NumberNegativePattern (int
 value)
public function get NumberNegativePattern
 () : int

public function set NumberNegativePattern
 (value : int)

プロパティ
負の数値の形式パターン。InvariantInfo の既定値は 1 で、"-n" を表しますn数値です。

例外例外
例外種類条件

ArgumentOutOfRangeException

プロパティが 0 より小さいか、4 より大きい値に設定されています。

InvalidOperationException

プロパティ設定されていますが、NumberFormatInfo が読み取り専用です。

解説解説

このプロパティは、次の表の値のいずれか 1 つとります記号 "-" は NegativeSign、n数値です。

関連付けられたパターン

0

(n)

1

-n

2

- n

3

n-

4

n -

使用例使用例

さまざまな NumberNegativePattern パターン使用して値を出力するコードの例次に示します

Imports System
Imports System.Globalization
Imports Microsoft.VisualBasic

Class SamplesNumberFormatInfo    
    
    Public Shared Sub Main()
        
        ' Creates a new NumberFormatinfo.
        Dim myNfi As New
 NumberFormatInfo()
        
        ' Takes a negative value.
        Dim myInt As Int64 = - 1234
        
        ' Displays the value with default formatting.
        Console.WriteLine("Default  " + ControlChars.Tab
 + ":" _
           + ControlChars.Tab + "{0}", myInt.ToString("N",
 myNfi))
        
        ' Displays the value with other patterns.
        Dim i As Integer
        For i = 0 To 4
            myNfi.NumberNegativePattern = i
            Console.WriteLine("Pattern {0}" + ControlChars.Tab
 + ":" _
               + ControlChars.Tab + "{1}", myNfi.NumberNegativePattern,
 _
               myInt.ToString("N", myNfi))
        Next i
    End Sub
End Class

' This code produces the following output.
' 
' Default         :       (1,234.00)
' Pattern 0       :       (1,234.00)
' Pattern 1       :       -1,234.00
' Pattern 2       :       - 1,234.00
' Pattern 3       :       1,234.00-
' Pattern 4       :       1,234.00 -
 using System;
 using System.Globalization;
 class SamplesNumberFormatInfo  {
 
    public static void Main()
  {
 
       // Creates a new NumberFormatinfo.
       NumberFormatInfo myNfi = new NumberFormatInfo();

       // Takes a negative value.
       Int64 myInt = -1234;

       // Displays the value with default formatting.
       Console.WriteLine( "Default  \t:\t{0}", myInt.ToString( "N",
 myNfi ) );

       // Displays the value with other patterns.
       for ( int i = 0; i <= 4; i++ )  {
          myNfi.NumberNegativePattern = i;
          Console.WriteLine( "Pattern {0}\t:\t{1}", myNfi.NumberNegativePattern,
 myInt.ToString( "N", myNfi ) );
       }
    }
 }
 /*
 This code produces the following output.
 
 Default         :       (1,234.00)
 Pattern 0       :       (1,234.00)
 Pattern 1       :       -1,234.00
 Pattern 2       :       - 1,234.00
 Pattern 3       :       1,234.00-
 Pattern 4       :       1,234.00 -
*/
using namespace System;
using namespace System::Globalization;
int main()
{
   
   // Creates a new NumberFormatinfo.
   NumberFormatInfo^ myNfi = gcnew NumberFormatInfo;
   
   // Takes a negative value.
   Int64 myInt = -1234;
   
   // Displays the value with default formatting.
   Console::WriteLine( "Default  \t:\t {0}", myInt.ToString( "N",
 myNfi ) );
   
   // Displays the value with other patterns.
   for ( int i = 0; i <= 4; i++ )
   {
      myNfi->NumberNegativePattern = i;
      Console::WriteLine( "Pattern {0}\t:\t {1}", myNfi->NumberNegativePattern,
 myInt.ToString( "N", myNfi ) );

   }
}

/*
This code produces the following output.

Default         :       (1, 234.00)
Pattern 0       :       (1, 234.00)
Pattern 1       :       -1, 234.00
Pattern 2       :       - 1, 234.00
Pattern 3       :       1, 234.00-
Pattern 4       :       1, 234.00 -
*/
import System.*;
import System.Globalization.*;

class SamplesNumberFormatInfo
{
    public static void main(String[]
 args)
    {
        // Creates a new NumberFormatinfo.
        NumberFormatInfo myNfi = new NumberFormatInfo();
        // Takes a negative value.
        Int64 myInt = (Int64)(-1234);
        // Displays the value with default formatting.
        Console.WriteLine("Default  \t:\t{0}", myInt.ToString("N",
 myNfi));
        // Displays the value with other patterns.
        for (int i = 0; i <= 4; i++) {
            myNfi.set_NumberNegativePattern(i);
            Console.WriteLine("Pattern {0}\t:\t{1}", (Int32)myNfi.
                get_NumberNegativePattern(), myInt.ToString("N", myNfi));
        }
    } //main
} //SamplesNumberFormatInfo

/*
 This code produces the following output.
 
 Default         :       -1,234.00
 Pattern 0       :       (1,234.00)
 Pattern 1       :       -1,234.00
 Pattern 2       :       - 1,234.00
 Pattern 3       :       1,234.00-
 Pattern 4       :       1,234.00 -
*/
import System
import System.Globalization

// Creates a new NumberFormatinfo.
var myNfi : NumberFormatInfo = new NumberFormatInfo()

// Takes a negative value.
var myInt : Int64 = - 1234

// Displays the value with default formatting.
Console.WriteLine("Default  \t:\t{0}", myInt.ToString("N", myNfi))

// Displays the value with other patterns.
for(var i = 0; i < 5; i++){
    myNfi.NumberNegativePattern = i
    Console.WriteLine("Pattern {0}\t:\t{1}", myNfi.NumberNegativePattern,
 myInt.ToString("N", myNfi))
}

// This code produces the following output.
// 
// Default         :       (1,234.00)
// Pattern 0       :       (1,234.00)
// Pattern 1       :       -1,234.00
// Pattern 2       :       - 1,234.00
// Pattern 3       :       1,234.00-
// Pattern 4       :       1,234.00 -
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
NumberFormatInfo クラス
NumberFormatInfo メンバ
System.Globalization 名前空間
NumberFormatInfo.NumberDecimalDigits プロパティ
NumberFormatInfo.NumberDecimalSeparator プロパティ
NumberFormatInfo.NumberGroupSeparator プロパティ
NumberFormatInfo.NumberGroupSizes プロパティ
NumberFormatInfo.NaNSymbol プロパティ
NumberFormatInfo.CurrencyNegativePattern プロパティ
PercentNegativePattern


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

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

辞書ショートカット

すべての辞書の索引

「NumberFormatInfo.NumberNegativePattern プロパティ」の関連用語

NumberFormatInfo.NumberNegativePattern プロパティのお隣キーワード
検索ランキング

   

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



NumberFormatInfo.NumberNegativePattern プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS