OptionConverter InstantiateByClassName Method | Apache log4net™ SDK Documentation

Instantiates an object given a class name.

Namespace: log4net.Util
Assembly: log4net (in log4net.dll) Version: 2.0.8.0-.NET 4.0
Syntax

C#
VB
C++
F#
Copy

    public static Object InstantiateByClassName(
    	string className,
    	Type superClass,
    	Object defaultValue
    )

    Public Shared Function InstantiateByClassName (
    	className As String,
    	superClass As Type,
    	defaultValue As Object
    ) As Object

    public:
    static Object^ InstantiateByClassName(
    	String^ className,
    	Type^ superClass,
    	Object^ defaultValue
    )

    static member InstantiateByClassName :
            className : string *
            superClass : Type *
            defaultValue : Object -> Object

#### Parameters

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

#### Return Value

Type: Object
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

#### Reference

OptionConverter Class
log4net.Util Namespace