ReferenceConverter 類別

定義

提供型別轉換子 (Type Converter) 將物件參考與其他表示相互轉換。Provides a type converter to convert object references to and from other representations.

public ref class ReferenceConverter : System::ComponentModel::TypeConverter
public class ReferenceConverter : System.ComponentModel.TypeConverter
type ReferenceConverter = class
    inherit TypeConverter
Public Class ReferenceConverter
Inherits TypeConverter
繼承
ReferenceConverter
衍生

備註

通常ReferenceConverter用於已放置元件或設計環境的內容中。The ReferenceConverter is typically used within the context of sited components or a design environment. 如果沒有元件網站或可供ITypeDescriptorContext使用, 這個轉換子就少了用。Without a component site or a usable ITypeDescriptorContext, this converter is of little use.

這個轉換器會轉換實作為IComponent介面之物件的參考, 並在 [屬性] 視窗中顯示其屬性。This converter converts a reference of an object that implements the IComponent interface and displays its properties in the Properties window.

如需類型轉換器的詳細資訊, 請TypeConverter參閱基底類別和如何:執行類型轉換器For more information about type converters, see the TypeConverter base class and How to: Implement a Type Converter.

注意

您絕對不應該建立ReferenceConverter類別的實例。You should never create an instance of the ReferenceConverter class. 請改為呼叫 GetConverter 類別的 TypeDescriptor 方法。Instead, call the GetConverter method of the TypeDescriptor class. 如需詳細資訊, 請參閱TypeConverter基類中的範例。For more information, see the examples in the TypeConverter base class.

這個類別會提供IsValueAllowed方法, 以檢查特定值是否可以加入至標準值集合。This class provides the IsValueAllowed method to check whether a particular value can be added to the standard values collection. 如果您不想要將值新增至集合, 請覆寫這個方法。If you do not want to add the value to the collection, override this method.

給繼承者的注意事項

當您不想要將值新增至標準值集合時, 請覆寫方法。IsValueAllowed(ITypeDescriptorContext, Object)Override the IsValueAllowed(ITypeDescriptorContext, Object) method when you do not want to add a value to the standard values collection.

建構函式

ReferenceConverter(Type)

初始化 ReferenceConverter 類別的新執行個體。Initializes a new instance of the ReferenceConverter class.

方法

CanConvertFrom(ITypeDescriptorContext, Type)

取得值,指出此轉換子是否可以使用指定的內容,將指定來源型別中的物件轉換成參考物件。Gets a value indicating whether this converter can convert an object in the given source type to a reference object using the specified context.

CanConvertFrom(Type)

傳回值,指出這個轉換子是否可將指定之型別的物件轉換為這個轉換子的型別。Returns whether this converter can convert an object of the given type to the type of this converter.

(繼承來源 TypeConverter)
CanConvertTo(ITypeDescriptorContext, Type)

傳回這個轉換器是否可以使用指定的內容,將物件轉換成指定的類型。Returns whether this converter can convert the object to the specified type, using the specified context.

(繼承來源 TypeConverter)
CanConvertTo(Type)

傳回值,指出這個轉換子是否可以將物件轉換成指定的型別。Returns whether this converter can convert the object to the specified type.

(繼承來源 TypeConverter)
ConvertFrom(ITypeDescriptorContext, CultureInfo, Object)

將指定的物件轉換為參考型別。Converts the given object to the reference type.

ConvertFrom(Object)

會將指定值轉換為這個轉換子的型別。Converts the given value to the type of this converter.

(繼承來源 TypeConverter)
ConvertFromInvariantString(ITypeDescriptorContext, String)

會使用不區分的文化特性和指定的內容,將指定的字串轉換為這個轉換子的型別。Converts the given string to the type of this converter, using the invariant culture and the specified context.

(繼承來源 TypeConverter)
ConvertFromInvariantString(String)

會使用不因文化特性而異,將指定字串轉換為這個轉換子的型別。Converts the given string to the type of this converter, using the invariant culture.

(繼承來源 TypeConverter)
ConvertFromString(ITypeDescriptorContext, CultureInfo, String)

會使用指定內容和文化特性資訊,將指定文字轉換為物件。Converts the given text to an object, using the specified context and culture information.

(繼承來源 TypeConverter)
ConvertFromString(ITypeDescriptorContext, String)

會使用指定的內容,將指定文字轉換為物件。Converts the given text to an object, using the specified context.

(繼承來源 TypeConverter)
ConvertFromString(String)

會將指定的文字轉換成物件。Converts the specified text to an object.

(繼承來源 TypeConverter)
ConvertTo(ITypeDescriptorContext, CultureInfo, Object, Type)

使用指定的內容和引數將指定值物件轉換成參考型別。Converts the given value object to the reference type using the specified context and arguments.

ConvertTo(Object, Type)

會使用引數,將指定值物件轉換成指定型別。Converts the given value object to the specified type, using the arguments.

(繼承來源 TypeConverter)
ConvertToInvariantString(ITypeDescriptorContext, Object)

會使用指定的內容,將指定值轉換成不因文化特性而異的字串表示。Converts the specified value to a culture-invariant string representation, using the specified context.

(繼承來源 TypeConverter)
ConvertToInvariantString(Object)

會將指定值轉換成不因文化特性而異的字串表示。Converts the specified value to a culture-invariant string representation.

(繼承來源 TypeConverter)
ConvertToString(ITypeDescriptorContext, CultureInfo, Object)

會使用指定的內容和文化特性資訊,將指定值轉換為字串表示。Converts the given value to a string representation, using the specified context and culture information.

(繼承來源 TypeConverter)
ConvertToString(ITypeDescriptorContext, Object)

會使用指定的內容,將指定值轉換為字串表示。Converts the given value to a string representation, using the given context.

(繼承來源 TypeConverter)
ConvertToString(Object)

會將指定值轉換成字串表示。Converts the specified value to a string representation.

(繼承來源 TypeConverter)
CreateInstance(IDictionary)

重新建立 Object,需為物件提供一組屬性值。Re-creates an Object given a set of property values for the object.

(繼承來源 TypeConverter)
CreateInstance(ITypeDescriptorContext, IDictionary)

使用指定的內容,建立與這個 TypeConverter 相關聯之類型的執行個體,並為物件提供一組屬性值。Creates an instance of the type that this TypeConverter is associated with, using the specified context, given a set of property values for the object.

(繼承來源 TypeConverter)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetConvertFromException(Object)

無法執行轉換時,會傳回要擲回的例外狀況。Returns an exception to throw when a conversion cannot be performed.

(繼承來源 TypeConverter)
GetConvertToException(Object, Type)

無法執行轉換時,會傳回要擲回的例外狀況。Returns an exception to throw when a conversion cannot be performed.

(繼承來源 TypeConverter)
GetCreateInstanceSupported()

傳回值,指出在這個物件上變更值時是否需要呼叫 CreateInstance(IDictionary) 方法來建立新值。Returns whether changing a value on this object requires a call to the CreateInstance(IDictionary) method to create a new value.

(繼承來源 TypeConverter)
GetCreateInstanceSupported(ITypeDescriptorContext)

會使用指定的內容,傳回在這個物件上變更值是否需要呼叫 CreateInstance(IDictionary) 來建立新值。Returns whether changing a value on this object requires a call to CreateInstance(IDictionary) to create a new value, using the specified context.

(繼承來源 TypeConverter)
GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetProperties(ITypeDescriptorContext, Object)

會使用指定的內容,傳回由值參數所指定之陣列型別的屬性集合。Returns a collection of properties for the type of array specified by the value parameter, using the specified context.

(繼承來源 TypeConverter)
GetProperties(ITypeDescriptorContext, Object, Attribute[])

使用指定的內容和屬性 (Attribute),傳回由值參數所指定之陣列型別的屬性 (Property) 集合。Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.

(繼承來源 TypeConverter)
GetProperties(Object)

傳回由值參數所指定之陣列型別的屬性集合。Returns a collection of properties for the type of array specified by the value parameter.

(繼承來源 TypeConverter)
GetPropertiesSupported()

傳回值,指出這個物件是否支援屬性。Returns whether this object supports properties.

(繼承來源 TypeConverter)
GetPropertiesSupported(ITypeDescriptorContext)

會使用指定的內容傳回數值,表示這個物件是否支援屬性。Returns whether this object supports properties, using the specified context.

(繼承來源 TypeConverter)
GetStandardValues()

從為這個型別轉換子所設計的資料型別預設內容中,會傳回標準值的集合。Returns a collection of standard values from the default context for the data type this type converter is designed for.

(繼承來源 TypeConverter)
GetStandardValues(ITypeDescriptorContext)

取得參考資料型別的標準值集合。Gets a collection of standard values for the reference data type.

GetStandardValuesExclusive()

傳回值,這個值表示從 GetStandardValues() 所傳回的標準值集合是否為獨佔清單。Returns whether the collection of standard values returned from GetStandardValues() is an exclusive list.

(繼承來源 TypeConverter)
GetStandardValuesExclusive(ITypeDescriptorContext)

取得值,表示從 GetStandardValues(ITypeDescriptorContext) 所傳回的標準值清單是否為獨佔清單。Gets a value indicating whether the list of standard values returned from GetStandardValues(ITypeDescriptorContext) is an exclusive list.

GetStandardValuesSupported()

會傳回這個物件是否支援可以從清單中挑選的標準值組。Returns whether this object supports a standard set of values that can be picked from a list.

(繼承來源 TypeConverter)
GetStandardValuesSupported(ITypeDescriptorContext)

取得值,表示這個物件是否支援可以從清單選取的標準值集合。Gets a value indicating whether this object supports a standard set of values that can be picked from a list.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
IsValid(ITypeDescriptorContext, Object)

會傳回指定值物件是否對這個型別和指定的內容有效。Returns whether the given value object is valid for this type and for the specified context.

(繼承來源 TypeConverter)
IsValid(Object)

會傳回指定值物件是否對這個型別有效。Returns whether the given value object is valid for this type.

(繼承來源 TypeConverter)
IsValueAllowed(ITypeDescriptorContext, Object)

傳回值,指出特定值是否可以加入至標準值集合。Returns a value indicating whether a particular value can be added to the standard values collection.

MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
SortProperties(PropertyDescriptorCollection, String[])

排序屬性的集合。Sorts a collection of properties.

(繼承來源 TypeConverter)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於