当前位置: 首页>>代码示例>>C#>>正文


C# Indexer类代码示例

本文整理汇总了C#中Indexer的典型用法代码示例。如果您正苦于以下问题:C# Indexer类的具体用法?C# Indexer怎么用?C# Indexer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Indexer类属于命名空间,在下文中一共展示了Indexer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Indexer_Index

        public void Indexer_Index()
        {
            var indexsource = new FeedsDbContextIndexSource(new FeedsDbEntities(), 100);
            var indexer = new Indexer<Document>(indexsource);

            indexer.Index();
        }
开发者ID:benmcevoy,项目名称:Rss,代码行数:7,代码来源:UnitTest1.cs

示例2: DfaState

		internal DfaState()
		{
			Indexer<DfaState>.Add(this);

			_trasition = new Indexer<DfaState>.Array(byte.MaxValue + 1);
			_nfaStates = null;
		}
开发者ID:five-x,项目名称:siprevo,代码行数:7,代码来源:DfaState.cs

示例3: CanReadIndiciesBack_SmallFile

        public void CanReadIndiciesBack_SmallFile()
        {
            var pulse = new Subject<Unit>();
            var scheduler = new TestScheduler();

            using (var file = new TestFile())
            {
                file.Append(Enumerable.Range(1, 100).Select(i => $"This is line number {i.ToString("00000000")}").ToArray());

                using (var indexer = new Indexer(file.Info.WatchFile(pulse).WithSegments(), scheduler: scheduler))
                {
                    IndexCollection result = null;
                    using (indexer.Result.Subscribe(indicies => result = indicies))

                    {
                        pulse.Once();

                        var head = result.ReadLines(new ScrollRequest(10, 0));
                        var headText = head.Select(l => l.Text).ToArray();
                        var headExpected = Enumerable.Range(1, 10).Select(i => $"This is line number {i.ToString("00000000")}");
                        headText.ShouldAllBeEquivalentTo(headExpected);

                        var tail = result.ReadLines(new ScrollRequest(10));
                        var tailText = tail.Select(l => l.Text).ToArray();
                        var tailExpected = Enumerable.Range(91, 10).Select(i => $"This is line number {i.ToString("00000000")}").ToArray();
                        tailText.ShouldAllBeEquivalentTo(tailExpected);

                        var mid = result.ReadLines(new ScrollRequest(10, 20));
                        var midText = mid.Select(l => l.Text).ToArray();
                        var midExpected = Enumerable.Range(21, 10).Select(i => $"This is line number {i.ToString("00000000")}").ToArray();
                        midText.ShouldAllBeEquivalentTo(midExpected);
                    }
                }
            }
        }
开发者ID:ItsJustSean,项目名称:TailBlazer,代码行数:35,代码来源:IndexerFixture.cs

示例4: Start

 public void Start()
 {
     _graphClient = CreateGraphClient();
     _indexer = CreateIndexer();
     _eventHandlerMapping = CreateEventHandlerMapping();
     ConnectToEventstore();
 }
开发者ID:jrgcubano,项目名称:CQRSShop,代码行数:7,代码来源:IndexingServie.cs

示例5: IndexerTest

        public void IndexerTest()
        {
            using (var indexer = new Indexer(this.Directory)) {

                var guids = new List<Guid>();
                guids.Add(IndexTest(indexer, TestDir + "Tika.rtf", "almonds"));
                guids.Add(IndexTest(indexer, TestDir + "Tika.pdf", "almonds"));
                guids.Add(IndexTest(indexer, TestDir + "Tika.docx", "almonds"));
                guids.Add(IndexTest(indexer, TestDir + "Tika.odt", "almonds"));
                guids.Add(IndexTest(indexer, TestDir + "Tika.pptx", "almonds"));
                guids.Add(IndexTest(indexer, TestDir + "Tika.xlsx", "almonds"));

                foreach (var guid in guids) {
                    indexer.Writer.DeleteDocuments(new Term("Id", guid.ToString()));
                    indexer.Refresh();
                    var docs = indexer.Searcher
                        .Search(new TermQuery(new Term(indexer.DocumentContentField, "almonds")), 1000)
            #if LuceneV290
                        .scoreDocs
                        .Select(sd => indexer.Searcher.Doc(sd.doc))
            #else
                        .ScoreDocs
                        .Select(sd => indexer.Searcher.Doc(sd.Doc))
            #endif
                        .ToArray();
                    Assert.IsFalse(docs.Any(d => d.GetField("Id").AsString() == guid.ToString()));

                }

            }
        }
开发者ID:xpohama,项目名称:Luceneria,代码行数:31,代码来源:LuceneTest.cs

示例6: Clamp1D

 public void Clamp1D()
 {
     List<int> data = new List<int>() { 0, 1, 2, 3 };
     Indexer<int> idx = new Indexer<int>(data, ClampMode.Clamp);
     Assert.AreEqual(0, idx[-1]);
     Assert.AreEqual(1, idx[1]);
     Assert.AreEqual(3, idx[5]);
 }
开发者ID:ddebowczyk,项目名称:CoreSociety,代码行数:8,代码来源:IndexerTests.cs

示例7: SetUp

 public void SetUp()
 {
     _dictionary = new Dictionary<string, Guid>();
     _guid = Guid.NewGuid();
     _key = "some key";
     _dictionary.Add(_key, _guid);
     _indexer = new Indexer<string, Guid>(s => _dictionary[s], (s, g) => _guid = g);
 }
开发者ID:joshuaflanagan,项目名称:fubumvc,代码行数:8,代码来源:IndexerTester.cs

示例8: Team

 /// <summary>Initializes a new team</summary>
 /// <remarks><see cref="Name"/> initializes according to <i>teamNumber</i>; <b>0</b> = "Imperial", <b>1</b> = "Rebel", other = "Team #"</remarks>
 /// <param name="teamNumber">Team index being initialized. Corrects to <b>0-9</b> as required</param>
 public Team(int teamNumber)
 {
     if (teamNumber <= 0) { _name = "Imperial"; _alliedWithTeam[0] = true; }
     else if (teamNumber == 1) _name = "Rebel";
     else _name = "Team " + (teamNumber > 8 ? 10 : teamNumber + 1);
     for (int i = 0; i < 6; i++) _endOfMissionMessages[i] = "";
     _eomMessageIndexer = new Indexer<string>(_endOfMissionMessages, 63);
 }
开发者ID:MikeG621,项目名称:Platform,代码行数:11,代码来源:Team.cs

示例9: For

        public static IEnumerable<IRequestData> For(IRequestData data, string prefix)
        {
            var indexer = new Indexer(prefix);

            while (data.HasChildRequest(indexer.Prefix))
            {
                yield return data.GetChildRequest(indexer.Prefix);
                indexer.Increment();
            }
        }
开发者ID:marcusswope,项目名称:Hit-That-Line,代码行数:10,代码来源:EnumerateFlatRequestData.cs

示例10: Scanner

 public Scanner(Settings settings)
 {
     indexer = new Indexer();
     indexer.MinLength = settings.MinLength;
     if (settings.UseStopWords)
     {
         TextReader rdr = new TextReader("stopwords.txt");
         indexer.SetStopWords(rdr.GetText());
     }
 }
开发者ID:trustmaster,项目名称:WordFreqAnalyzer,代码行数:10,代码来源:Scanner.cs

示例11: Repeat1D

 public void Repeat1D()
 {
     List<int> data = new List<int>() { 0, 1, 2, 3 };
     Indexer<int> idx = new Indexer<int>(data, ClampMode.Repeat);
     Assert.AreEqual(3, idx[-1]);
     Assert.AreEqual(2, idx[-2]);
     Assert.AreEqual(1, idx[1]);
     Assert.AreEqual(1, idx[5]);
     Assert.AreEqual(0, idx[8]);
 }
开发者ID:ddebowczyk,项目名称:CoreSociety,代码行数:10,代码来源:IndexerTests.cs

示例12: Main

	public static int Main (string[] args)
	{
		Indexer indexer = new Indexer ();

		foreach (string filename in args) {
			Console.WriteLine ("\nparse: " + filename);
			indexer.Parse (filename);
		}

		return 0;
	}
开发者ID:emtees,项目名称:old-code,代码行数:11,代码来源:App.cs

示例13: VisitIndexer

    public override Expression VisitIndexer(Indexer indexer) 
    {
      ExpressionList ops = this.VisitExpressionList(indexer.Operands);
      System.Diagnostics.Debug.Assert(ops != null, "VisitExpressionList must return non-null if passed non-null");
      indexer.Operands = ops;

      Expression obj = this.VisitExpression(indexer.Object);
      System.Diagnostics.Debug.Assert(obj != null, "VisitExpression must return non-null if passed non-null");
      indexer.Object = obj;
      return indexer;
    }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:11,代码来源:EmptyVisitor.cs

示例14: Wrap2D

 public void Wrap2D()
 {
     List<int> data = new List<int>() {
         00, 01, 02,
         10, 11, 12,
         20, 21, 22 };
     Indexer<int> idx = new Indexer<int>(data, 3);
     Assert.AreEqual(20, idx[-1, 0]);
     Assert.AreEqual(2, idx[0, -1]);
     Assert.AreEqual(0, idx[0, 0]);
     Assert.AreEqual(12, idx[1, 2]);
     Assert.AreEqual(20, idx[1, 3]);
     Assert.AreEqual(10, idx[3, 3]);
 }
开发者ID:ddebowczyk,项目名称:CoreSociety,代码行数:14,代码来源:IndexerTests.cs

示例15: IndexerTest

        public void IndexerTest()
        {
            const int length = 5;
            var list = Enumerable.Range(0, length).ToList();
            var indexer = new Indexer<int>(()=>list.Count, (i)=>list[i], (i,v) => list[i] = v);

            indexer.Count.Is(length);
            for (int i = 0; i < indexer.Count; i++)
            {
                indexer[i].Is(i);
                indexer[i] = i * i;
                indexer[i].Is(i*i);
            }
        }
开发者ID:manbou404,项目名称:CSharpLab,代码行数:14,代码来源:IndexerTests.cs


注:本文中的Indexer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。