Partager via


IVsDataProvider.GetAssembly Method (Guid, String)

Resolves a provider-specific assembly string to its corresponding Assembly representation, for a specific DDEX data source.

Namespace:  Microsoft.VisualStudio.Data.Core
Assembly:  Microsoft.VisualStudio.Data.Core (in Microsoft.VisualStudio.Data.Core.dll)

Syntax

'Declaration
Function GetAssembly ( _
    source As Guid, _
    assemblyString As String _
) As Assembly
Assembly GetAssembly(
    Guid source,
    string assemblyString
)
Assembly^ GetAssembly(
    Guid source, 
    String^ assemblyString
)
abstract GetAssembly : 
        source:Guid * 
        assemblyString:string -> Assembly
function GetAssembly(
    source : Guid, 
    assemblyString : String
) : Assembly

Parameters

  • source
    Type: System.Guid

    A DDEX data source identifier.

  • assemblyString
    Type: System.String

    A provider-specific assembly string.

Return Value

Type: System.Reflection.Assembly
An Assembly object that represents the assembly that is resolved from the specified assembly string for the specified DDEX data source, if found; otherwise, nulla null reference (Nothing in Visual Basic).

Exceptions

Exception Condition
ArgumentNullException

The assemblyString parameter is nulla null reference (Nothing in Visual Basic).

[<ANY>]

The DDEX provider’s GetAssembly or GetAssembly implementation threw an exception.

Remarks

This method checks whether the source parameter value is a non-empty GUID, and, if it is, calls the DDEX provider’s GetAssembly method, if one exists. If no assembly is available at this point, it calls the GetAssembly method.

Examples

The following code demonstrates how to call this method with a provider-specific assembly string and then retrieve a string resource from the assembly.

using System;
using System.IO;
using System.Reflection;
using Microsoft.VisualStudio.Data.Core;
using Microsoft.VisualStudio.Data.Services.SupportEntities;

public class DDEX_IVsDataProviderExample3
{
    public static Stream GetProviderString(IVsDataProvider provider,
        string resourceName, string assemblyString)
    {
        Assembly assembly = provider.GetAssembly(assemblyString);
        return assembly.GetManifestResourceStream(resourceName);
    }
}

.NET Framework Security

See Also

Reference

IVsDataProvider Interface

GetAssembly Overload

Microsoft.VisualStudio.Data.Core Namespace