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

适用于