Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions snippets/fsharp/System/ApplicationId/Overview/fs.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Include="program.fs" />
</ItemGroup>
</Project>
43 changes: 43 additions & 0 deletions snippets/fsharp/System/ApplicationId/Overview/program.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//<Snippet1>
open System
open System.Collections
open System.Text
open System.Security.Policy
open System.Reflection
open System.Security
open System.Security.Permissions

[<SecurityPermission(SecurityAction.Demand, ControlDomainPolicy = true)>]
let main _ =
//<Snippet2>
printfn $"Full name = {AppDomain.CurrentDomain.ActivationContext.Identity.FullName}"
//</Snippet2>
//<Snippet3>
printfn $"Code base = {AppDomain.CurrentDomain.ActivationContext.Identity.CodeBase}"
//</Snippet3>
//<Snippet6>
//<Snippet7>
let asi = ApplicationSecurityInfo AppDomain.CurrentDomain.ActivationContext

printfn $"ApplicationId.Name property = {asi.ApplicationId.Name}"
//</Snippet7>
//<Snippet8>
if asi.ApplicationId.Culture <> null then
printfn $"ApplicationId.Culture property = {asi.ApplicationId.Culture}"
//</Snippet8>
//<Snippet9>
printfn $"ApplicationId.ProcessorArchitecture property = {asi.ApplicationId.ProcessorArchitecture}"
//</Snippet9>
//<Snippet10>
printfn $"ApplicationId.Version property = {asi.ApplicationId.Version}"
//</Snippet10>
//<Snippet11>
// To display the value of the public key, enumerate the Byte array for the property.
printf "ApplicationId.PublicKeyToken property = "
let pk = asi.ApplicationId.PublicKeyToken
for i = 0 to pk.GetLength 0 - 1 do
printf $"{pk[i]:x}"
//</Snippet11>
//</Snippet6>
Console.Read()
//</Snippet1>
6 changes: 6 additions & 0 deletions xml/System/ApplicationId.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
The following code example displays the <xref:System.ApplicationId> properties by obtaining the <xref:System.ApplicationId> from an <xref:System.Security.Policy.ApplicationSecurityInfo> instance created using the <xref:System.ActivationContext> for the currently executing manifest-based application.

:::code language="csharp" source="~/snippets/csharp/System/ApplicationId/Overview/program.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System/ApplicationId/Overview/program.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ApplicationIdentity/VB/program.vb" id="Snippet1":::

]]></format>
Expand Down Expand Up @@ -241,6 +242,7 @@
The following code example displays the <xref:System.ApplicationId.Culture%2A> property by obtaining the <xref:System.ApplicationId> from an <xref:System.Security.Policy.ApplicationSecurityInfo> instance created using the <xref:System.ActivationContext> for the currently executing manifest-based application. This code example is part of a larger example provided for the <xref:System.ApplicationId> class.

:::code language="csharp" source="~/snippets/csharp/System/ApplicationId/Overview/program.cs" id="Snippet8":::
:::code language="fsharp" source="~/snippets/fsharp/System/ApplicationId/Overview/program.fs" id="Snippet8":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ApplicationIdentity/VB/program.vb" id="Snippet8":::

]]></format>
Expand Down Expand Up @@ -404,6 +406,7 @@
The following code example displays the <xref:System.ApplicationId.Name%2A> property by obtaining the <xref:System.ApplicationId> from an <xref:System.Security.Policy.ApplicationSecurityInfo> instance created using the <xref:System.ActivationContext> for the currently executing manifest-based application. This code example is part of a larger example provided for the <xref:System.ApplicationId> class.

:::code language="csharp" source="~/snippets/csharp/System/ApplicationId/Overview/program.cs" id="Snippet7":::
:::code language="fsharp" source="~/snippets/fsharp/System/ApplicationId/Overview/program.fs" id="Snippet7":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ApplicationIdentity/VB/program.vb" id="Snippet7":::

]]></format>
Expand Down Expand Up @@ -460,6 +463,7 @@
The following code example displays the <xref:System.ApplicationId.ProcessorArchitecture%2A> property by obtaining the <xref:System.ApplicationId> from an <xref:System.Security.Policy.ApplicationSecurityInfo> instance created using the <xref:System.ActivationContext> for the currently executing manifest-based application. This code example is part of a larger example provided for the <xref:System.ApplicationId> class.

:::code language="csharp" source="~/snippets/csharp/System/ApplicationId/Overview/program.cs" id="Snippet9":::
:::code language="fsharp" source="~/snippets/fsharp/System/ApplicationId/Overview/program.fs" id="Snippet9":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ApplicationIdentity/VB/program.vb" id="Snippet9":::

]]></format>
Expand Down Expand Up @@ -517,6 +521,7 @@
The following code example displays the <xref:System.ApplicationId.PublicKeyToken%2A> property by obtaining the <xref:System.ApplicationId> from an <xref:System.Security.Policy.ApplicationSecurityInfo> instance created using the <xref:System.ActivationContext> for the currently executing manifest-based application. This code example is part of a larger example provided for the <xref:System.ApplicationId> class.

:::code language="csharp" source="~/snippets/csharp/System/ApplicationId/Overview/program.cs" id="Snippet11":::
:::code language="fsharp" source="~/snippets/fsharp/System/ApplicationId/Overview/program.fs" id="Snippet11":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ApplicationIdentity/VB/program.vb" id="Snippet11":::

]]></format>
Expand Down Expand Up @@ -620,6 +625,7 @@
The following code example displays the <xref:System.ApplicationId.Version%2A> property by obtaining the <xref:System.ApplicationId> from an <xref:System.Security.Policy.ApplicationSecurityInfo> instance created using the <xref:System.ActivationContext> for the currently executing manifest-based application. This code example is part of a larger example provided for the <xref:System.ApplicationId> class.

:::code language="csharp" source="~/snippets/csharp/System/ApplicationId/Overview/program.cs" id="Snippet10":::
:::code language="fsharp" source="~/snippets/fsharp/System/ApplicationId/Overview/program.fs" id="Snippet10":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ApplicationIdentity/VB/program.vb" id="Snippet10":::

]]></format>
Expand Down