NumberFormatInfo.IsReadOnly プロパティ


この NumberFormatInfo オブジェクトが読み取り専用かどうかを示す値を取得します。Gets a value that indicates whether this NumberFormatInfo object is read-only.

 property bool IsReadOnly { bool get(); };
public bool IsReadOnly { get; }
member this.IsReadOnly : bool
Public ReadOnly Property IsReadOnly As Boolean



true が読み取り専用である場合は NumberFormatInfo。それ以外の場合は falsetrue if the NumberFormatInfo is read-only; otherwise, false.


読み取り専用のプロパティへの割り当てを実行しようとすると NumberFormatInfo 、が発生 InvalidOperationException します。Attempting to perform an assignment to a property of a read-only NumberFormatInfo causes an InvalidOperationException.

Clone次の例に示すように、メソッドを呼び出して、読み取り専用のオブジェクトから読み取り/書き込みオブジェクトを作成でき NumberFormatInfo ます。You can call the Clone method to create a read/write NumberFormatInfo object from a read-only object, as the following example illustrates.

using System;
using System.Globalization;

public class Example
   public static void Main()
      NumberFormatInfo nfi = NumberFormatInfo.CurrentInfo;
      Console.WriteLine("Read-Only: {0}\n", nfi.IsReadOnly);

      NumberFormatInfo nfiw = (NumberFormatInfo) nfi.Clone();
      Console.WriteLine("Read-Only: {0}", nfiw.IsReadOnly);
// The example displays the following output:
//       Read-Only: True
//       Read-Only: False
Imports System.Globalization

Module Example
   Public Sub Main()
      Dim nfi As NumberFormatInfo = NumberFormatInfo.CurrentInfo
      Console.WriteLine("Read-Only: {0}", nfi.IsReadOnly)
      Dim nfiw As NumberFormatInfo = CType(nfi.Clone(), NumberFormatInfo)
      Console.WriteLine("Read-Only: {0}", nfiw.IsReadOnly)
   End Sub
End Module
' The example displays the following output:
'       Read-Only: True
'       Read-Only: False