Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

AbstractApplicationContext.GetObject(String, Type) Method

Return an instance (possibly shared or independent) of the given object name.

[Visual Basic]
Public NotOverridable Overloads Sub GetObject( _
   ByVal name As String, _
   ByVal requiredType As Type _
) _
    Implements IObjectFactory.GetObject
[C#]
public object GetObject(
   string name,
   Type requiredType
);

Parameters

name
The name of the object to return.
requiredType
Type the object may match. Can be an interface or superclass of the actual class. For example, if the value is the Object class, this method will succeed whatever the class of the returned instance.

Return Value

The instance of the object.

Implements

IObjectFactory.GetObject

Exceptions

Exception Type Condition
NoSuchObjectDefinitionException If there's no such object definition.
ObjectsException If the object could not be created.
ObjectNotOfRequiredTypeException If the object is not of the required type.

See Also

AbstractApplicationContext Class | Spring.Context.Support Namespace | AbstractApplicationContext.GetObject Overload List | GetObject