ServicedComponent.CanBePooled 方法

定义

在将对象放回到池中之前结构调用该方法。 重写此方法以决定是否将对象放回到池中。

protected public:
 virtual bool CanBePooled();
protected internal virtual bool CanBePooled ();
abstract member CanBePooled : unit -> bool
override this.CanBePooled : unit -> bool
Protected Friend Overridable Function CanBePooled () As Boolean

返回

如果已维护的组件可被放入池中,则为 true;否则为 false

示例

下面的代码示例演示了此方法的使用。

// This object can be pooled.
virtual bool CanBePooled() override
{
   return (true);
}
// This object can be pooled.
protected override bool CanBePooled()
{
    return(true);
}
' This object can be pooled.
Protected Overrides Function CanBePooled() As Boolean 
    Return True

End Function 'CanBePooled

适用于