GacMembershipCondition.Copy 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立成員資格條件的相等複本。
public:
virtual System::Security::Policy::IMembershipCondition ^ Copy();
public System.Security.Policy.IMembershipCondition Copy ();
abstract member Copy : unit -> System.Security.Policy.IMembershipCondition
override this.Copy : unit -> System.Security.Policy.IMembershipCondition
Public Function Copy () As IMembershipCondition
傳回
新的 GacMembershipCondition 物件。
實作
範例
下列程式代碼範例示範 如何使用 Copy 方法。 這個範例是提供給 類別之較大範例的 GacMembershipCondition 一部分。
GacMembershipCondition ^ Gac1 = gcnew GacMembershipCondition;
Console::WriteLine("Original membership condition = ");
Console::WriteLine(Gac1->ToXml());
try
{
IMembershipCondition^ membershipCondition = Gac1->Copy();
Console::WriteLine("Result of Copy = ");
Console::WriteLine(
(dynamic_cast<GacMembershipCondition^>(membershipCondition))
->ToXml());
}
catch (Exception^ e)
{
Console::WriteLine("Copy failed : {0}{1}", Gac1, e);
return false;
}
GacMembershipCondition Gac1 = new GacMembershipCondition();
Console.WriteLine("Original membership condition = ");
Console.WriteLine(Gac1.ToXml().ToString());
try
{
IMembershipCondition membershipCondition = Gac1.Copy();
Console.WriteLine("Result of Copy = ");
Console.WriteLine(
((GacMembershipCondition)membershipCondition).ToXml().ToString()
);
}
catch (Exception e)
{
Console.WriteLine("Copy failed : " + Gac1.ToString() + e);
return false;
}
Dim Gac1 As New GacMembershipCondition
Console.WriteLine("Original membership condition = ")
Console.WriteLine(Gac1.ToXml().ToString())
Try
Dim membershipCondition As IMembershipCondition = Gac1.Copy()
Console.WriteLine("Result of Copy = ")
Console.WriteLine(CType(membershipCondition, _
GacMembershipCondition).ToXml().ToString())
Catch e As Exception
Console.WriteLine(("Copy failed : " & Gac1.ToString() & _
e.ToString()))
Return False
End Try
備註
成員資格條件的復本與原始成員資格條件相同。