Microsoft.Activities.Extensions |
StrictXamlHelper..::..InitializeComponent<(Of <(<'T>)>)> Method |
StrictXamlHelper Class Example See Also Send Feedback |
Initializes the Component with strict assembly resolution rules
Namespace: Microsoft.Activities.Extensions
Assembly: Microsoft.Activities.Extensions (in Microsoft.Activities.Extensions.dll) Version: 2.0.6.9 (2.0.6.9)
Syntax
C# |
---|
public static bool InitializeComponent<T>( T component, string resourceName, IList<string> assemblies ) where T : Activity |
Visual Basic |
---|
Public Shared Function InitializeComponent(Of T As Activity) ( _ component As T, _ resourceName As String, _ assemblies As IList(Of String) _ ) As Boolean |
Visual C++ |
---|
public: generic<typename T> where T : Activity static bool InitializeComponent( T component, String^ resourceName, IList<String^>^ assemblies ) |
Parameters
- component
- Type: T
The component.
- resourceName
- Type: System..::..String
The resource Name.
- assemblies
- Type: System.Collections.Generic..::..IList<(Of <(<'String>)>)>
The referenced assemblies.
Type Parameters
- T
- The type of activity you are initializing
Return Value
true if content loadedRemarks
The InitializeComponent method generated by the XamlAppDef build task uses a version independent loading strategy for referenced assemblies.
This helper method will ensure that only assemblies provided in the assemblies list will be loaded.
Examples
A overloaded constructor that accepts a XamlAssemblyResolutionOption
CopyC#
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="WorkflowCompiled.cs" company="Microsoft"> // Copyright (c) Microsoft Corporation. All rights reserved. // </copyright> // -------------------------------------------------------------------------------------------------------------------- using System.Collections.Generic; using System.Reflection; using Microsoft.Activities.Extensions; /// <summary> /// The WorkflowCompiled class /// </summary> // ReSharper disable CheckNamespace public partial class WorkflowCompiled // ReSharper restore CheckNamespace { #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="WorkflowCompiled"/> class. /// </summary> /// <param name="assemblyResolutionOption"> /// The assembly resolution option. /// </param> public WorkflowCompiled(XamlAssemblyResolutionOption assemblyResolutionOption) { switch (assemblyResolutionOption) { case XamlAssemblyResolutionOption.VersionIndependent: this.InitializeComponent(); break; case XamlAssemblyResolutionOption.FullName: StrictXamlHelper.InitializeComponent(this, this.FindResource(), ReferencedAssemblies); break; } } #endregion #region Public Properties /// <summary> /// Gets ReferencedAssemblies. /// </summary> public static IList<string> ReferencedAssemblies { get { // Create a list of activities you want to reference here // You must add the currently executing assembly var list = new List<string> { "ActivityLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c18b97d2d48a43ab", Assembly.GetExecutingAssembly().GetName().FullName }; // Add the standard list of references list.AddRange(StrictXamlHelper.StandardCSharpReferencedAssemblies); return list; } } #endregion }