Class ReferenceManagerExtensions
Inheritance
System.Object
ReferenceManagerExtensions
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public static class ReferenceManagerExtensions : object
Methods
| Improve this Doc View SourceGetContext<T>(ReferenceManager<T>)
Obtain the current reference.
Like Acquire(), but intended for use in a using block so calling Release(G) happens implicitly. For example:
var searcherManager = new SearcherManager(indexWriter, true, null);
using (var context = searcherManager.GetContext())
{
IndexSearcher searcher = context.Reference;
// use searcher...
}
Declaration
public static ReferenceContext<T> GetContext<T>(this ReferenceManager<T> referenceManager)
where T : class
Parameters
Type | Name | Description |
---|---|---|
ReferenceManager<T> | referenceManager | this ReferenceManager<G> |
Returns
Type | Description |
---|---|
ReferenceContext<T> | A ReferenceContext<T> instance that holds the Reference and ensures it is released properly when Dispose() is called. |
Type Parameters
Name | Description |
---|---|
T | The reference type |