diff --git a/snippets/fsharp/System/ApplicationId/Overview/fs.fsproj b/snippets/fsharp/System/ApplicationId/Overview/fs.fsproj new file mode 100644 index 00000000000..180a33ea226 --- /dev/null +++ b/snippets/fsharp/System/ApplicationId/Overview/fs.fsproj @@ -0,0 +1,10 @@ + + + Exe + net48 + + + + + + \ No newline at end of file diff --git a/snippets/fsharp/System/ApplicationId/Overview/program.fs b/snippets/fsharp/System/ApplicationId/Overview/program.fs new file mode 100644 index 00000000000..07775b9a76e --- /dev/null +++ b/snippets/fsharp/System/ApplicationId/Overview/program.fs @@ -0,0 +1,43 @@ +// +open System +open System.Collections +open System.Text +open System.Security.Policy +open System.Reflection +open System.Security +open System.Security.Permissions + +[] +let main _ = + // + printfn $"Full name = {AppDomain.CurrentDomain.ActivationContext.Identity.FullName}" + // + // + printfn $"Code base = {AppDomain.CurrentDomain.ActivationContext.Identity.CodeBase}" + // + // + // + let asi = ApplicationSecurityInfo AppDomain.CurrentDomain.ActivationContext + + printfn $"ApplicationId.Name property = {asi.ApplicationId.Name}" + // + // + if asi.ApplicationId.Culture <> null then + printfn $"ApplicationId.Culture property = {asi.ApplicationId.Culture}" + // + // + printfn $"ApplicationId.ProcessorArchitecture property = {asi.ApplicationId.ProcessorArchitecture}" + // + // + printfn $"ApplicationId.Version property = {asi.ApplicationId.Version}" + // + // + // 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}" + // + // + Console.Read() +// \ No newline at end of file diff --git a/xml/System/ApplicationId.xml b/xml/System/ApplicationId.xml index 89d0c0e09b2..19c18372666 100644 --- a/xml/System/ApplicationId.xml +++ b/xml/System/ApplicationId.xml @@ -67,6 +67,7 @@ The following code example displays the properties by obtaining the from an instance created using the 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"::: ]]> @@ -241,6 +242,7 @@ The following code example displays the property by obtaining the from an instance created using the for the currently executing manifest-based application. This code example is part of a larger example provided for the 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"::: ]]> @@ -404,6 +406,7 @@ The following code example displays the property by obtaining the from an instance created using the for the currently executing manifest-based application. This code example is part of a larger example provided for the 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"::: ]]> @@ -460,6 +463,7 @@ The following code example displays the property by obtaining the from an instance created using the for the currently executing manifest-based application. This code example is part of a larger example provided for the 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"::: ]]> @@ -517,6 +521,7 @@ The following code example displays the property by obtaining the from an instance created using the for the currently executing manifest-based application. This code example is part of a larger example provided for the 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"::: ]]> @@ -620,6 +625,7 @@ The following code example displays the property by obtaining the from an instance created using the for the currently executing manifest-based application. This code example is part of a larger example provided for the 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"::: ]]>