Share via


IVsDataProvider.GetString Method

Gets a localized string from the DDEX provider.

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

Syntax

'Declaration
Function GetString ( _
    resourceId As String _
) As String
string GetString(
    string resourceId
)
String^ GetString(
    String^ resourceId
)
abstract GetString : 
        resourceId:string -> string
function GetString(
    resourceId : String
) : String

Parameters

  • resourceId
    Type: System.String

    The identifier of the string resource to retrieve.

Return Value

Type: System.String
The localized value of the string resource, if the resource ID is valid and identifies an existing resource; otherwise, nulla null reference (Nothing in Visual Basic).

Exceptions

Exception Condition
ArgumentNullException

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

Remarks

A DDEX provider can expose various resource IDs for localized strings, like a display name and description. These resource IDs are accessed by DDEX clients that then look up the actual localized string by calling this method.

A DDEX provider resource ID can come in two forms. The first enables looking up managed resource strings and has the format Name, Resource [, Assembly]. Following is an example of a resource ID in this form: SqlProvider_DisplayName, MyResources, MyAssembly. GetString parses the resource strings and calls the GetAssembly method to resolve any assembly that is specified in the string. The second form enables looking up resource strings in packages, and has the format #nnnn where nnnn is the integer ID of the resource in the package. An example of a resource ID in this form is #3021. The second form is less common and applies only when the DDEX provider is package based.

Examples

The following code demonstrates how to manually retrieve the display name of a DDEX provider.

using System;
using Microsoft.VisualStudio.Data.Core;

public class DDEX_IVsDataProviderExample5
{
    public static string GetDisplayName(
        IVsDataProvider provider)
    {
        string displayName = String.Empty;
        string resourceId = provider.GetProperty("DisplayName") as string;
        if (resourceId != null)
        {
            displayName = provider.GetString(resourceId);
        }
        return displayName;
    }
}

.NET Framework Security

See Also

Reference

IVsDataProvider Interface

Microsoft.VisualStudio.Data.Core Namespace