Show / Hide Table of Contents

    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 Source

    GetContext<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

    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)