log4net SDK Reference |

# OptionConverter.ConvertStringTo Method

Converts a string to an object.

[Visual Basic]
Public Shared Function ConvertStringTo( _
ByVal target As Type, _
ByVal txt As String _
) As Object
[C#]
public static object ConvertStringTo(
Type target,
string txt
);

#### Parameters

target
  The target type to convert to.
txt
  The string to convert to an object.

#### Return Value

The object converted from a string or `null` when the conversion failed.

#### Remarks

Converts a string to an object. Uses the converter registry to try to convert the string value into the specified target type.

#### See Also

OptionConverter Class | log4net.Util Namespace