OidCollection.Item[] 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
Oid 개체에서 OidCollection 개체를 가져옵니다.
오버로드
Item[Int32] |
Oid 개체에서 OidCollection 개체를 가져옵니다. |
Item[String] |
Oid 개체의 지정된 문자열 값과 일치하는 Value 속성 값이나 FriendlyName 속성 값이 들어 있는 첫 번째 OidCollection 개체를 가져옵니다. |
Item[Int32]
- Source:
- OidCollection.cs
- Source:
- OidCollection.cs
- Source:
- OidCollection.cs
Oid 개체에서 OidCollection 개체를 가져옵니다.
public:
property System::Security::Cryptography::Oid ^ default[int] { System::Security::Cryptography::Oid ^ get(int index); };
public System.Security.Cryptography.Oid this[int index] { get; }
member this.Item(int) : System.Security.Cryptography.Oid
Default Public ReadOnly Property Item(index As Integer) As Oid
매개 변수
속성 값
Oid 개체입니다.
예제
다음 코드 예제에서는 OidCollection 클래스를 사용하는 방법을 보여 줍니다.
#using <system.dll>
using namespace System;
using namespace System::Security::Cryptography;
int main()
{
// Assign values to strings.
String^ Value1 = "1.2.840.113549.1.1.1";
String^ Name1 = "3DES";
String^ Value2 = "1.3.6.1.4.1.311.20.2";
String^ InvalidName = "This name is not a valid name";
String^ InvalidValue = "1.1.1.1.1.1.1.1";
// Create new Oid objects using the specified values.
// Note that the corresponding Value or Friendly Name property is automatically added to the object.
Oid ^ o1 = gcnew Oid( Value1 );
Oid ^ o2 = gcnew Oid( Name1 );
// Create a new Oid object using the specified Value and Friendly Name properties.
// Note that the two are not compared to determine if the Value is associated
// with the Friendly Name.
Oid ^ o3 = gcnew Oid( Value2,InvalidName );
//Create a new Oid object using the specified Value. Note that if the value
// is invalid or not known, no value is assigned to the Friendly Name property.
Oid ^ o4 = gcnew Oid( InvalidValue );
//Write out the property information of the Oid objects.
Console::WriteLine( "Oid1: Automatically assigned Friendly Name: {0}, {1}", o1->FriendlyName, o1->Value );
Console::WriteLine( "Oid2: Automatically assigned Value: {0}, {1}", o2->FriendlyName, o2->Value );
Console::WriteLine( "Oid3: Name and Value not compared: {0}, {1}", o3->FriendlyName, o3->Value );
Console::WriteLine( "Oid4: Invalid Value used: {0}, {1} {2}", o4->FriendlyName, o4->Value, Environment::NewLine );
//Create an Oid collection and add several Oid objects.
OidCollection ^ oc = gcnew OidCollection;
oc->Add( o1 );
oc->Add( o2 );
oc->Add( o3 );
Console::WriteLine( "Number of Oids in the collection: {0}", oc->Count );
Console::WriteLine( "Is synchronized: {0} {1}", oc->IsSynchronized, Environment::NewLine );
//Create an enumerator for moving through the collection.
OidEnumerator ^ oe = oc->GetEnumerator();
//You must execute a MoveNext() to get to the first item in the collection.
oe->MoveNext();
// Write out Oids in the collection.
Console::WriteLine( "First Oid in collection: {0},{1}", oe->Current->FriendlyName, oe->Current->Value );
oe->MoveNext();
Console::WriteLine( "Second Oid in collection: {0},{1}", oe->Current->FriendlyName, oe->Current->Value );
//Return index in the collection to the beginning.
oe->Reset();
}
using System;
using System.Security.Cryptography;
public class OidSample
{
public static void Main()
{
// Assign values to strings.
string Value1 = "1.2.840.113549.1.1.1";
string Name1 = "3DES";
string Value2 = "1.3.6.1.4.1.311.20.2";
string InvalidName = "This name is not a valid name";
string InvalidValue = "1.1.1.1.1.1.1.1";
// Create new Oid objects using the specified values.
// Note that the corresponding Value or Friendly Name property is automatically added to the object.
Oid o1 = new Oid(Value1);
Oid o2 = new Oid(Name1);
// Create a new Oid object using the specified Value and Friendly Name properties.
// Note that the two are not compared to determine if the Value is associated
// with the Friendly Name.
Oid o3 = new Oid(Value2, InvalidName);
//Create a new Oid object using the specified Value. Note that if the value
// is invalid or not known, no value is assigned to the Friendly Name property.
Oid o4 = new Oid(InvalidValue);
//Write out the property information of the Oid objects.
Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0}, {1}", o1.FriendlyName, o1.Value);
Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}", o2.FriendlyName, o2.Value);
Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}", o3.FriendlyName, o3.Value);
Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", o4.FriendlyName, o4.Value, Environment.NewLine);
//Create an Oid collection and add several Oid objects.
OidCollection oc = new OidCollection();
oc.Add(o1);
oc.Add(o2);
oc.Add(o3);
Console.WriteLine("Number of Oids in the collection: {0}", oc.Count);
Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized, Environment.NewLine);
//Create an enumerator for moving through the collection.
OidEnumerator oe = oc.GetEnumerator();
//You must execute a MoveNext() to get to the first item in the collection.
oe.MoveNext();
// Write out Oids in the collection.
Console.WriteLine("First Oid in collection: {0},{1}", oe.Current.FriendlyName,oe.Current.Value);
oe.MoveNext();
Console.WriteLine("Second Oid in collection: {0},{1}", oe.Current.FriendlyName, oe.Current.Value);
//Return index in the collection to the beginning.
oe.Reset();
}
}
Imports System.Security.Cryptography
Public Class OidSample
Shared msg As String
Public Shared Sub Main()
' Assign values to strings.
Dim Value1 As String = "1.2.840.113549.1.1.1"
Dim Name1 As String = "3DES"
Dim Value2 As String = "1.3.6.1.4.1.311.20.2"
Dim InvalidName As String = "This name is not a valid name"
Dim InvalidValue As String = "1.1.1.1.1.1.1.1"
' Create new Oid objects using the specified values.
' Note that the corresponding Value or Friendly Name property is automatically added to the object.
Dim o1 As New Oid(Value1)
Dim o2 As New Oid(Name1)
' Create a new Oid object using the specified Value and Friendly Name properties.
' Note that the two are not compared to determine if the Value is associated
' with the Friendly Name.
Dim o3 As New Oid(Value2, InvalidName)
'Create a new Oid object using the specified Value. Note that if the value
' is invalid or not known, no value is assigned to the Friendly Name property.
Dim o4 As New Oid(InvalidValue)
'Write out the property information of the Oid objects.
msg = "Oid1: Automatically assigned Friendly Name: " & o1.FriendlyName & ", " & o1.Value
MsgBox(msg)
'Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0}, {1}", o1.FriendlyName, o1.Value)
'Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}", o2.FriendlyName, o2.Value)
msg = "Oid2: Automatically assigned Value: " & o2.FriendlyName & ", " & o2.Value
MsgBox(msg)
'Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}", o3.FriendlyName, o3.Value)
msg = "Oid3: Name and Value not compared: " & o3.FriendlyName & ", " & o3.Value
MsgBox(msg)
' Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", o4.FriendlyName, o4.Value, Environment.NewLine)
msg = "Oid4: Invalid Value used: " & o4.FriendlyName & ", " & o4.Value
MsgBox(msg)
'Create an Oid collection and add several Oid objects.
Dim oc As New OidCollection()
oc.Add(o1)
oc.Add(o2)
oc.Add(o3)
' Console.WriteLine("Number of Oids in the collection: {0}", oc.Count)
' Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized, Environment.NewLine)
msg = "Number of Oids in the collection: " & oc.Count
MsgBox(msg)
msg = "Is synchronized: " & oc.IsSynchronized
MsgBox(msg)
'Create an enumerator for moving through the collection.
Dim oe As OidEnumerator = oc.GetEnumerator()
'You must execute a MoveNext() to get to the first item in the collection.
oe.MoveNext()
' Write out Oids in the collection.
'Console.WriteLine("First Oid in collection: {0},{1}", oe.Current.FriendlyName, oe.Current.Value)
msg = "First Oid in collection: " & oe.Current.FriendlyName & ", " & oe.Current.Value
MsgBox(msg)
oe.MoveNext()
' Console.WriteLine("Second Oid in collection: {0},{1}", oe.Current.FriendlyName, oe.Current.Value)
msg = "Second Oid in collection: " & oe.Current.FriendlyName & ", " & oe.Current.Value
MsgBox(msg)
'Return index in the collection to the beginning.
oe.Reset()
End Sub
End Class
설명
개체의 위치를 알고 있는 경우 이 메서드를 OidCollection 사용하여 개체에서 개체를 검색 Oid 합니다. 사용할 수 있습니다는 Item[] 개체의 값을 알고 있는 경우 개체 Value 를 검색 Oid 하는 속성 또는 FriendlyName 속성입니다.
적용 대상
Item[String]
- Source:
- OidCollection.cs
- Source:
- OidCollection.cs
- Source:
- OidCollection.cs
Oid 개체의 지정된 문자열 값과 일치하는 Value 속성 값이나 FriendlyName 속성 값이 들어 있는 첫 번째 OidCollection 개체를 가져옵니다.
public:
property System::Security::Cryptography::Oid ^ default[System::String ^] { System::Security::Cryptography::Oid ^ get(System::String ^ oid); };
public System.Security.Cryptography.Oid? this[string oid] { get; }
public System.Security.Cryptography.Oid this[string oid] { get; }
member this.Item(string) : System.Security.Cryptography.Oid
Default Public ReadOnly Property Item(oid As String) As Oid
매개 변수
- oid
- String
Value 속성이나 FriendlyName 속성을 나타내는 문자열입니다.
속성 값
Oid 개체입니다.
예제
다음 코드 예제에서는 OidCollection 클래스를 사용하는 방법을 보여 줍니다.
#using <system.dll>
using namespace System;
using namespace System::Security::Cryptography;
int main()
{
// Assign values to strings.
String^ Value1 = "1.2.840.113549.1.1.1";
String^ Name1 = "3DES";
String^ Value2 = "1.3.6.1.4.1.311.20.2";
String^ InvalidName = "This name is not a valid name";
String^ InvalidValue = "1.1.1.1.1.1.1.1";
// Create new Oid objects using the specified values.
// Note that the corresponding Value or Friendly Name property is automatically added to the object.
Oid ^ o1 = gcnew Oid( Value1 );
Oid ^ o2 = gcnew Oid( Name1 );
// Create a new Oid object using the specified Value and Friendly Name properties.
// Note that the two are not compared to determine if the Value is associated
// with the Friendly Name.
Oid ^ o3 = gcnew Oid( Value2,InvalidName );
//Create a new Oid object using the specified Value. Note that if the value
// is invalid or not known, no value is assigned to the Friendly Name property.
Oid ^ o4 = gcnew Oid( InvalidValue );
//Write out the property information of the Oid objects.
Console::WriteLine( "Oid1: Automatically assigned Friendly Name: {0}, {1}", o1->FriendlyName, o1->Value );
Console::WriteLine( "Oid2: Automatically assigned Value: {0}, {1}", o2->FriendlyName, o2->Value );
Console::WriteLine( "Oid3: Name and Value not compared: {0}, {1}", o3->FriendlyName, o3->Value );
Console::WriteLine( "Oid4: Invalid Value used: {0}, {1} {2}", o4->FriendlyName, o4->Value, Environment::NewLine );
//Create an Oid collection and add several Oid objects.
OidCollection ^ oc = gcnew OidCollection;
oc->Add( o1 );
oc->Add( o2 );
oc->Add( o3 );
Console::WriteLine( "Number of Oids in the collection: {0}", oc->Count );
Console::WriteLine( "Is synchronized: {0} {1}", oc->IsSynchronized, Environment::NewLine );
//Create an enumerator for moving through the collection.
OidEnumerator ^ oe = oc->GetEnumerator();
//You must execute a MoveNext() to get to the first item in the collection.
oe->MoveNext();
// Write out Oids in the collection.
Console::WriteLine( "First Oid in collection: {0},{1}", oe->Current->FriendlyName, oe->Current->Value );
oe->MoveNext();
Console::WriteLine( "Second Oid in collection: {0},{1}", oe->Current->FriendlyName, oe->Current->Value );
//Return index in the collection to the beginning.
oe->Reset();
}
using System;
using System.Security.Cryptography;
public class OidSample
{
public static void Main()
{
// Assign values to strings.
string Value1 = "1.2.840.113549.1.1.1";
string Name1 = "3DES";
string Value2 = "1.3.6.1.4.1.311.20.2";
string InvalidName = "This name is not a valid name";
string InvalidValue = "1.1.1.1.1.1.1.1";
// Create new Oid objects using the specified values.
// Note that the corresponding Value or Friendly Name property is automatically added to the object.
Oid o1 = new Oid(Value1);
Oid o2 = new Oid(Name1);
// Create a new Oid object using the specified Value and Friendly Name properties.
// Note that the two are not compared to determine if the Value is associated
// with the Friendly Name.
Oid o3 = new Oid(Value2, InvalidName);
//Create a new Oid object using the specified Value. Note that if the value
// is invalid or not known, no value is assigned to the Friendly Name property.
Oid o4 = new Oid(InvalidValue);
//Write out the property information of the Oid objects.
Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0}, {1}", o1.FriendlyName, o1.Value);
Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}", o2.FriendlyName, o2.Value);
Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}", o3.FriendlyName, o3.Value);
Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", o4.FriendlyName, o4.Value, Environment.NewLine);
//Create an Oid collection and add several Oid objects.
OidCollection oc = new OidCollection();
oc.Add(o1);
oc.Add(o2);
oc.Add(o3);
Console.WriteLine("Number of Oids in the collection: {0}", oc.Count);
Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized, Environment.NewLine);
//Create an enumerator for moving through the collection.
OidEnumerator oe = oc.GetEnumerator();
//You must execute a MoveNext() to get to the first item in the collection.
oe.MoveNext();
// Write out Oids in the collection.
Console.WriteLine("First Oid in collection: {0},{1}", oe.Current.FriendlyName,oe.Current.Value);
oe.MoveNext();
Console.WriteLine("Second Oid in collection: {0},{1}", oe.Current.FriendlyName, oe.Current.Value);
//Return index in the collection to the beginning.
oe.Reset();
}
}
Imports System.Security.Cryptography
Public Class OidSample
Shared msg As String
Public Shared Sub Main()
' Assign values to strings.
Dim Value1 As String = "1.2.840.113549.1.1.1"
Dim Name1 As String = "3DES"
Dim Value2 As String = "1.3.6.1.4.1.311.20.2"
Dim InvalidName As String = "This name is not a valid name"
Dim InvalidValue As String = "1.1.1.1.1.1.1.1"
' Create new Oid objects using the specified values.
' Note that the corresponding Value or Friendly Name property is automatically added to the object.
Dim o1 As New Oid(Value1)
Dim o2 As New Oid(Name1)
' Create a new Oid object using the specified Value and Friendly Name properties.
' Note that the two are not compared to determine if the Value is associated
' with the Friendly Name.
Dim o3 As New Oid(Value2, InvalidName)
'Create a new Oid object using the specified Value. Note that if the value
' is invalid or not known, no value is assigned to the Friendly Name property.
Dim o4 As New Oid(InvalidValue)
'Write out the property information of the Oid objects.
msg = "Oid1: Automatically assigned Friendly Name: " & o1.FriendlyName & ", " & o1.Value
MsgBox(msg)
'Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0}, {1}", o1.FriendlyName, o1.Value)
'Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}", o2.FriendlyName, o2.Value)
msg = "Oid2: Automatically assigned Value: " & o2.FriendlyName & ", " & o2.Value
MsgBox(msg)
'Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}", o3.FriendlyName, o3.Value)
msg = "Oid3: Name and Value not compared: " & o3.FriendlyName & ", " & o3.Value
MsgBox(msg)
' Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", o4.FriendlyName, o4.Value, Environment.NewLine)
msg = "Oid4: Invalid Value used: " & o4.FriendlyName & ", " & o4.Value
MsgBox(msg)
'Create an Oid collection and add several Oid objects.
Dim oc As New OidCollection()
oc.Add(o1)
oc.Add(o2)
oc.Add(o3)
' Console.WriteLine("Number of Oids in the collection: {0}", oc.Count)
' Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized, Environment.NewLine)
msg = "Number of Oids in the collection: " & oc.Count
MsgBox(msg)
msg = "Is synchronized: " & oc.IsSynchronized
MsgBox(msg)
'Create an enumerator for moving through the collection.
Dim oe As OidEnumerator = oc.GetEnumerator()
'You must execute a MoveNext() to get to the first item in the collection.
oe.MoveNext()
' Write out Oids in the collection.
'Console.WriteLine("First Oid in collection: {0},{1}", oe.Current.FriendlyName, oe.Current.Value)
msg = "First Oid in collection: " & oe.Current.FriendlyName & ", " & oe.Current.Value
MsgBox(msg)
oe.MoveNext()
' Console.WriteLine("Second Oid in collection: {0},{1}", oe.Current.FriendlyName, oe.Current.Value)
msg = "Second Oid in collection: " & oe.Current.FriendlyName & ", " & oe.Current.Value
MsgBox(msg)
'Return index in the collection to the beginning.
oe.Reset()
End Sub
End Class
설명
개체의 또는 FriendlyName 속성 값을 알고 있는 경우 개체에서 OidCollection 개체를 Value 검색 Oid 하려면 이 속성을 Oid 사용합니다. 사용 하 여는 Item[] 속성을 검색할 수 있습니다는 Oid 컬렉션에서 해당 위치를 알고 있는 경우 개체입니다.
적용 대상
.NET