Compartir a través de


IVsDataProvider.GetString (Método)

从 DDEX 提供程序获取已本地化的字符串。

Espacio de nombres:  Microsoft.VisualStudio.Data.Core
Ensamblado:  Microsoft.VisualStudio.Data.Core (en Microsoft.VisualStudio.Data.Core.dll)

Sintaxis

'Declaración
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

Parámetros

  • resourceId
    Tipo: String

    检索的字符串资源的标识符。

Valor devuelto

Tipo: String
字符串资源的本地化值,如果资源 ID,有效并标识现有资源;否则,返回 nullreferencia null (Nothing en Visual Basic)。

Excepciones

Excepción Condición
ArgumentNullException

resourceId 参数为 nullreferencia null (Nothing en Visual Basic)。

Comentarios

DDEX 提供程序可以公开本地化字符串的多种资源 ID,如显示名称和说明。 这些资源 ID 通过调用此方法来查找实际的本地化字符串的 DDEX 客户端访问。

提供程序 DDEX 资源 ID 可以分为两种形式。 第一个启用查找托管资源字符串并具有格式为 名称, 资源 [, 程序集]。 下面的资源 ID 的示例。以下模式:SqlProvider_DisplayName, MyResources, MyAssembly。 GetString 分析资源字符串以及调用 GetAssembly 方法来解析在字符串指定的所有程序集。 第二个窗体启用搜索包中的资源字符串,并具有格式 #nnnnnnnn 是资源的整数 ID 包中的位置。 资源 ID 的示例。此模式为 #3021。 在 DDEX 提供程序都基于时,包的第二个窗体不常见的并应用。

Ejemplos

下面的代码演示如何手动检索 DDEX 提供程序的显示名称。

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;
    }
}

Seguridad de .NET Framework

Vea también

Referencia

IVsDataProvider Interfaz

Microsoft.VisualStudio.Data.Core (Espacio de nombres)