log4net SDK Reference |

# OptionConverter.InstantiateByClassName Method

Instantiates an object given a class name.

[Visual Basic]
Public Shared Function InstantiateByClassName( _
ByVal className As String, _
ByVal superClass As Type, _
ByVal defaultValue As Object _
) As Object
[C#]
public static object InstantiateByClassName(
string className,
Type superClass,
object defaultValue
);

#### Parameters

className
  The fully qualified class name of the object to instantiate.
superClass
  The class to which the new object should belong.
defaultValue
  The object to return in case of non-fulfillment.

#### Return Value

An instance of the className or defaultValue if the object could not be instantiated.

#### Remarks

Checks that the className is a subclass of superClass. If that test fails or the object could not be instantiated, then defaultValue is returned.

#### See Also

OptionConverter Class | log4net.Util Namespace