Show / Hide Table of Contents

Class ErrorMessagesInColorConverter

Although its scope is public, the only practical use for this class is to facilitate storage of default or user specified ErrorMessagesInColor values in application settings files. That being the case, I put it at the end of the source file that defines that class.

Inheritance
System.Object
ErrorMessagesInColorConverter
Namespace: WizardWrx.ConsoleStreams
Assembly: WizardWrx.ConsoleStreams.dll
Syntax
public class ErrorMessagesInColorConverter : TypeConverter

Methods

| Improve this Doc View Source

CanConvertFrom(ITypeDescriptorContext, Type)

Return True if inputs of the specified type can be converted.

Declaration
public override bool CanConvertFrom(ITypeDescriptorContext pIContext, Type ptypSourceType)
Parameters
Type Name Description
ITypeDescriptorContext pIContext

This argument provides internal details about the type. Treat it as a black box.

Type ptypSourceType

This argument specifies the System.Type to be evaluated. Treat it as a black box.

Returns
Type Description
System.Boolean

This method returns TRUE if ptypSourceType is typeof ( string ). Any other type returns FALSE.

Remarks

This method and its companions ConvertFrom and ConvertTo are delegates, which the runtime engine calls as needed. Hence, the arguments described above as black boxes are required, although this implementation ignores them, since it processes string representations of the System.Console.ConsoleColors enumerated type.

| Improve this Doc View Source

ConvertFrom(ITypeDescriptorContext, System.Globalization.CultureInfo, Object)

Convert from string (the only supported source type) to ErrorMessagesInColor.

Declaration
public override object ConvertFrom(ITypeDescriptorContext pIContext, System.Globalization.CultureInfo pCulture, object pobjValue)
Parameters
Type Name Description
ITypeDescriptorContext pIContext

This argument provides internal details about the type. Treat it as a black box.

System.Globalization.CultureInfo pCulture

This argument supplies a reference to the current CultureInfo object that drives many aspects of text and numeric conversions. Treat it as a black box.

System.Object pobjValue

Specify the source object to be converted. Although the method signature requires this argument to be cast to Object, the only type supported is System.string. In any event, treat it as a black box.

Returns
Type Description
System.Object

Although specified as object to meet the requirements of the base class, the return value is expected to be an ErrorMessagesInColor object.

Remarks

This method and its companions CanConvertFrom and ConvertTo are delegates, which the runtime engine calls as needed. Hence, the arguments described above as black boxes are required, although this implementation ignores them, since it processes string representations of the System.Console.ConsoleColors enumerated type.

| Improve this Doc View Source

ConvertTo(ITypeDescriptorContext, System.Globalization.CultureInfo, Object, Type)

Given an ErrorMessagesInColor object, return a string representation that is suitable for storage in a standard application settings file.

Declaration
public override object ConvertTo(ITypeDescriptorContext pIContext, System.Globalization.CultureInfo pCulture, object pobjValue, Type pDestType)
Parameters
Type Name Description
ITypeDescriptorContext pIContext

This argument provides internal details about the type. Treat it as a black box.

System.Globalization.CultureInfo pCulture

This argument supplies a reference to the current CultureInfo object that drives many aspects of text and numeric conversions. Treat it as a black box.

System.Object pobjValue

Although the method signature calls for an generic System.Object, this argument must actually be an ErrorMessagesInColor object.

Type pDestType

The only valid value for this argument is typeof ( string ). The specification type is dictated by the signature of the ConvertTo method in the base class.

Returns
Type Description
System.Object

Although specified as object to meet the requirements of the base class, the return value is expected to be a System.string.

Remarks

This method and its companions CanConvertFrom and ConvertFrom are delegates, which the runtime engine calls as needed. Hence, the arguments described above as black boxes are required, although this implementation ignores them, since it processes string representations of the System.Console.ConsoleColors enumerated type.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX