NumberFormatInfo.IsReadOnly Propriété

Définition

Obtient une valeur qui indique si cet objet NumberFormatInfo est en lecture seule.

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

Valeur de propriété

Boolean

true si NumberFormatInfo est en lecture seule ; sinon, false.

Remarques

La tentative d’exécution d’une assignation à une propriété d’un en lecture seule NumberFormatInfo provoque un InvalidOperationException .

Vous pouvez appeler la Clone méthode pour créer un objet en lecture/écriture NumberFormatInfo à partir d’un objet en lecture seule, comme l’illustre l’exemple suivant.

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)
      Console.WriteLine()
      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

S’applique à

Voir aussi