厳密な名前 ID の簡易名の部分を取得または設定します。
Public Property Name As String
[C#]
public string Name {get; set;}
[C++]
public: __property String* get_Name();public: __property void set_Name(String*);
[JScript]
public function get Name() : String;public function set Name(String);
プロパティ値
ID の簡易名。
解説
Name の値には、厳密な名前を使用することもできますし、最後の位置にワイルドカードを指定した名前を使用することもできます。たとえば、MyCompany.MyDepartment.MyFile と MyCompany.MyDepartment.* は、両方とも有効な名前です。
使用例
' Intersect creates and returns a new permission that is the intersection of the current
' permission and the permission specified.
Private Function IntersectDemo() As Boolean
Dim returnValue As Boolean = True
Dim Sn1, Sn2 As String
Dim SnIdPerm1, SnIdPerm2, SnIdPerm3 As StrongNameIdentityPermission
Dim SnGen1 As New SnGenerator()
Dim SnGen2 As New SnGenerator()
SnGen1.ResetIndex()
While SnGen1.CreateSn(SnIdPerm1, Sn1)
If SnIdPerm1 Is Nothing Then
GoTo ContinueWhile1
End If
Console.WriteLine("**********************************************************" + ControlChars.Lf)
SnGen2.ResetIndex()
While SnGen2.CreateSn(SnIdPerm2, Sn2)
If SnIdPerm2 Is Nothing Then
GoTo ContinueWhile2
End If
Dim firstPermission As String = IIf(Sn1 = "" Or Sn1 Is Nothing, "null", Sn1)
Dim secondPermission As String = IIf(Sn2 = "" Or Sn2 Is Nothing, "null", Sn2)
Try
SnIdPerm3 = CType(SnIdPerm1.Intersect(SnIdPerm2), StrongNameIdentityPermission)
If Not (SnIdPerm3 Is Nothing) AndAlso Not (SnIdPerm3.Name Is Nothing) Then
Console.WriteLine(("The intersection of " + firstPermission + ControlChars.Lf + ControlChars.Tab + "and " + secondPermission + " = " + ControlChars.Lf + ControlChars.Tab + CType(SnIdPerm3, StrongNameIdentityPermission).Name.ToString()))
Else
Console.WriteLine(("The intersection of " + firstPermission + ControlChars.Lf + ControlChars.Tab + "and " + secondPermission + " is null."))
End If
Catch e As Exception
Console.WriteLine(("An exception was thrown for intersection " + e.ToString()))
returnValue = False
End Try
ContinueWhile2:
End While
ContinueWhile1:
End While
Return returnValue
End Function 'IntersectDemo
[C#]
// Intersect creates and returns a new permission that is the intersection of the current
// permission and the permission specified.
private bool IntersectDemo()
{
bool returnValue = true;
string sn1,sn2;
StrongNameIdentityPermission snIdPerm1,snIdPerm2,snIdPerm3;
SnGenerator snGen1 = new SnGenerator();
SnGenerator snGen2 = new SnGenerator();
snGen1.ResetIndex();
while(snGen1.CreateSn(out snIdPerm1, out sn1))
{
if(snIdPerm1 == null) continue;
Console.WriteLine("**********************************************************\n");
snGen2.ResetIndex();
while(snGen2.CreateSn(out snIdPerm2, out sn2))
{
if(snIdPerm2 == null) continue;
string firstPermission = sn1 == "" | sn1 == null ? "null" : sn1 ;
string secondPermission = sn2 == "" | sn2 == null ? "null" : sn2;
try
{
snIdPerm3 = (StrongNameIdentityPermission)snIdPerm1.Intersect(snIdPerm2);
if (snIdPerm3 != null && snIdPerm3.Name != null)
{
Console.WriteLine("The intersection of " + firstPermission + "\n\tand "
+ secondPermission + " = \n\t"
+ ((StrongNameIdentityPermission)snIdPerm3).Name.ToString());
}
else
{
Console.WriteLine("The intersection of " + firstPermission + "\n\tand "
+ secondPermission + " is null.");
}
}
catch(Exception e)
{
Console.WriteLine("An exception was thrown for intersection " + e);
returnValue=false;
}
}
}
return returnValue;
}
[C++]
// Intersect creates and returns a new permission that is the intersection of the current
// permission and the permission specified.
bool IntersectDemo() {
bool returnValue = true;
String* sn1, *sn2;
StrongNameIdentityPermission *snIdPerm1, *snIdPerm2, *snIdPerm3;
SnGenerator* snGen1 = new SnGenerator();
SnGenerator* snGen2 = new SnGenerator();
snGen1->ResetIndex();
while(snGen1->CreateSn(&snIdPerm1, &sn1)) {
if (snIdPerm1 == 0) continue;
Console::WriteLine(S"**********************************************************\n");
snGen2->ResetIndex();
while(snGen2->CreateSn(&snIdPerm2, &sn2)) {
if (snIdPerm2 == 0) continue;
String* firstPermission = sn1->Equals(S"") || sn1 == 0 ? S"null" : sn1 ;
String* secondPermission = sn2->Equals(S"") || sn2 == 0 ? S"null" : sn2;
try {
snIdPerm3 = dynamic_cast<StrongNameIdentityPermission*>(snIdPerm1->Intersect(snIdPerm2));
if (snIdPerm3 != 0 && snIdPerm3->Name != 0) {
Console::WriteLine(S"The intersection of {0}\n\tand {1} = \n\t{2}",
firstPermission,
secondPermission,
(dynamic_cast<StrongNameIdentityPermission*>(snIdPerm3))->Name);
} else {
Console::WriteLine(S"The intersection of {0}\n\tand {1} is null.",
firstPermission, secondPermission);
}
} catch (Exception* e) {
Console::WriteLine(S"An exception was thrown for intersection {0}", e);
returnValue=false;
}
}
}
return returnValue;
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
StrongNameIdentityPermission クラス | StrongNameIdentityPermission メンバ | System.Security.Permissions 名前空間