CultureInfo.ReadOnly(CultureInfo) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 CultureInfo 개체의 읽기 전용 래퍼를 반환합니다.
public:
static System::Globalization::CultureInfo ^ ReadOnly(System::Globalization::CultureInfo ^ ci);
public static System.Globalization.CultureInfo ReadOnly (System.Globalization.CultureInfo ci);
static member ReadOnly : System.Globalization.CultureInfo -> System.Globalization.CultureInfo
Public Shared Function ReadOnly (ci As CultureInfo) As CultureInfo
매개 변수
- ci
- CultureInfo
래핑할 CultureInfo 개체입니다.
반환
ci
주변의 읽기 전용 CultureInfo 래퍼입니다.
예외
ci
가 null입니다.
예제
다음 예제에서는 메서드가 ReadOnly 와 연결된 및 NumberFormatInfo 인스턴스를 보호하는 DateTimeFormatInfo 데 도움이 되는 것을 CultureInfo보여 줍니다.
using namespace System;
using namespace System::Globalization;
int main()
{
// Creates a CultureInfo.
CultureInfo^ myCI = gcnew CultureInfo( "en-US" );
// Creates a read-only CultureInfo based on myCI ->
CultureInfo^ myReadOnlyCI = CultureInfo::ReadOnly( myCI );
// Display the read-only status of each CultureInfo and their DateTimeFormat and NumberFormat properties.
Console::WriteLine( "myCI is {0}.", myCI->IsReadOnly ? (String^)"read only" : "writable" );
Console::WriteLine( "myCI -> DateTimeFormat is {0}.", myCI->DateTimeFormat->IsReadOnly ? (String^)"read only" : "writable" );
Console::WriteLine( "myCI -> NumberFormat is {0}.", myCI->NumberFormat->IsReadOnly ? (String^)"read only" : "writable" );
Console::WriteLine( "myReadOnlyCI is {0}.", myReadOnlyCI->IsReadOnly ? (String^)"read only" : "writable" );
Console::WriteLine( "myReadOnlyCI -> DateTimeFormat is {0}.", myReadOnlyCI->DateTimeFormat->IsReadOnly ? (String^)"read only" : "writable" );
Console::WriteLine( "myReadOnlyCI -> NumberFormat is {0}.", myReadOnlyCI->NumberFormat->IsReadOnly ? (String^)"read only" : "writable" );
}
/*
This code produces the following output.
myCI is writable.
myCI -> DateTimeFormat is writable.
myCI -> NumberFormat is writable.
myReadOnlyCI is read only.
myReadOnlyCI -> DateTimeFormat is read only.
myReadOnlyCI -> NumberFormat is read only.
*/
using System;
using System.Globalization;
public class SamplesCultureInfo {
public static void Main() {
// Creates a CultureInfo.
CultureInfo myCI = new CultureInfo( "en-US" );
// Creates a read-only CultureInfo based on myCI.
CultureInfo myReadOnlyCI = CultureInfo.ReadOnly( myCI );
// Display the read-only status of each CultureInfo and their DateTimeFormat and NumberFormat properties.
Console.WriteLine( "myCI is {0}.", myCI.IsReadOnly ? "read only" : "writable" );
Console.WriteLine( "myCI.DateTimeFormat is {0}.", myCI.DateTimeFormat.IsReadOnly ? "read only" : "writable" );
Console.WriteLine( "myCI.NumberFormat is {0}.", myCI.NumberFormat.IsReadOnly ? "read only" : "writable" );
Console.WriteLine( "myReadOnlyCI is {0}.", myReadOnlyCI.IsReadOnly ? "read only" : "writable" );
Console.WriteLine( "myReadOnlyCI.DateTimeFormat is {0}.", myReadOnlyCI.DateTimeFormat.IsReadOnly ? "read only" : "writable" );
Console.WriteLine( "myReadOnlyCI.NumberFormat is {0}.", myReadOnlyCI.NumberFormat.IsReadOnly ? "read only" : "writable" );
}
}
/*
This code produces the following output.
myCI is writable.
myCI.DateTimeFormat is writable.
myCI.NumberFormat is writable.
myReadOnlyCI is read only.
myReadOnlyCI.DateTimeFormat is read only.
myReadOnlyCI.NumberFormat is read only.
*/
Imports System.Globalization
Public Class SamplesCultureInfo
Public Shared Sub Main()
' Creates a CultureInfo.
Dim myCI As New CultureInfo("en-US")
' Creates a read-only CultureInfo based on myCI.
Dim myReadOnlyCI As CultureInfo = CultureInfo.ReadOnly(myCI)
' Display the read-only status of each CultureInfo and their DateTimeFormat and NumberFormat properties.
If myCI.IsReadOnly Then
Console.WriteLine("myCI is read only.")
Else
Console.WriteLine("myCI is writable.")
End If
If myCI.DateTimeFormat.IsReadOnly Then
Console.WriteLine("myCI.DateTimeFormat is read only.")
Else
Console.WriteLine("myCI.DateTimeFormat is writable.")
End If
If myCI.NumberFormat.IsReadOnly Then
Console.WriteLine("myCI.NumberFormat is read only.")
Else
Console.WriteLine("myCI.NumberFormat is writable.")
End If
If myReadOnlyCI.IsReadOnly Then
Console.WriteLine("myReadOnlyCI is read only.")
Else
Console.WriteLine("myReadOnlyCI is writable.")
End If
If myReadOnlyCI.DateTimeFormat.IsReadOnly Then
Console.WriteLine("myReadOnlyCI.DateTimeFormat is read only.")
Else
Console.WriteLine("myReadOnlyCI.DateTimeFormat is writable.")
End If
If myReadOnlyCI.NumberFormat.IsReadOnly Then
Console.WriteLine("myReadOnlyCI.NumberFormat is read only.")
Else
Console.WriteLine("myReadOnlyCI.NumberFormat is writable.")
End If
End Sub
End Class
' This code produces the following output.
'
' myCI is writable.
' myCI.DateTimeFormat is writable.
' myCI.NumberFormat is writable.
' myReadOnlyCI is read only.
' myReadOnlyCI.DateTimeFormat is read only.
' myReadOnlyCI.NumberFormat is read only.
설명
이 래퍼는 , 또는 에서 반환된 개체 및 ci
NumberFormat 속성을 수정ci
하지 못하도록 합니다.ci
DateTimeFormat
적용 대상
추가 정보
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET