次の方法で共有


DataProviderObjectFactory.GetType Method (String)

Resolves a provider-specific type name to its corresponding Type representation.

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

Syntax

'宣言
Public Overridable Function GetType ( _
    typeName As String _
) As Type
'使用
Dim instance As DataProviderObjectFactory
Dim typeName As String
Dim returnValue As Type

returnValue = instance.GetType(typeName)
public virtual Type GetType(
    string typeName
)
public:
virtual Type^ GetType(
    String^ typeName
)
public function GetType(
    typeName : String
) : Type

Parameters

Return Value

Type: System.Type

A Type object representing the type resolved from the specified type name, if found; otherwise, a null reference (Nothing in Visual Basic).

Implements

IVsDataProviderObjectFactory.GetType(String)

Exceptions

Exception Condition
ArgumentNullException

The typeName parameter is a null reference (Nothing in Visual Basic).

Remarks

This method is useful when there are type names specified as strings in formats like a data support XML file, and these type names cannot be automatically resolved (or would be resolved incorrectly) by the CLR’s GetType method. One use of this method is to expand an unspecified namespace. (For example, if the string is "MyType", it might get expanded to "Company.Product.MyType" before the CLR resolves it.)

This method is provided to shorten a provider’s specification of type names, which can help reduce duplication of elements, like a common namespace, throughout the code base.

The base class implementation tries to locate a comma separating the type name from its qualifying assembly, and, if found, calls the GetAssembly method with the assembly qualifier and then, if found, tries to retrieve the type from this assembly. Otherwise it calls GetAssembly with an empty string and, if found, tries to get the type from this assembly. Finally, if the type is still not found, it calls the standard GetType method and returns the result of this call.

Permissions

See Also

Reference

DataProviderObjectFactory Class

DataProviderObjectFactory Members

GetType Overload

Microsoft.VisualStudio.Data.Framework Namespace