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


C# LinkedList.Get方法代码示例

本文整理汇总了C#中LinkedList.Get方法的典型用法代码示例。如果您正苦于以下问题:C# LinkedList.Get方法的具体用法?C# LinkedList.Get怎么用?C# LinkedList.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LinkedList的用法示例。


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

示例1: TestLinkedListOperators

        public void TestLinkedListOperators()
        {
            var lst = new LinkedList<int>();
            lst.Append(1);
            lst.Append(2);
            lst.Append(4);
            lst.Append(5);
            lst.Insert(2, 3);
            Assert.AreEqual(lst.Get(2).Content, 3);
            Assert.AreEqual(lst.Get(3).Content, 4);

            lst.Remove(0);
            Assert.AreEqual(lst.Get(0).Content, 2);

            Assert.AreEqual(lst.ToString(), "2 3 4 5");
        }
开发者ID:BotterVN,项目名称:CodeSnippets,代码行数:16,代码来源:TestList.cs

示例2: GetLastItemTest

 [TestMethod] // получение последнего элемента
 public void GetLastItemTest()
 {
     LinkedList<object> data = new LinkedList<object>();
     data.Append(4);
     data.Append(2);
     data.Get(1);
 }
开发者ID:steeparts,项目名称:Muftiyev_Arthur_06,代码行数:8,代码来源:LinkedListTest.cs

示例3: GetFirstItemTest

 [TestMethod] // получение первого элемента
 public void GetFirstItemTest()
 {
     LinkedList<object> data = new LinkedList<object>();
     data.Append(8);
     data.Append(10);
     data.Get(0);
 }
开发者ID:steeparts,项目名称:Muftiyev_Arthur_06,代码行数:8,代码来源:LinkedListTest.cs

示例4: buildRichTextRuns

	public void buildRichTextRuns(LinkedList pStyles, LinkedList cStyles, String RunRawText){

        // Handle case of no current style, with a default
        if(pStyles.Count == 0 || cStyles.Count == 0) {
            _rtRuns = new RichTextRun[1];
            _rtRuns[0] = new RichTextRun(this, 0, RunRawText.Length);
        } else {
            // Build up Rich Text Runs, one for each
            //  character/paragraph style pair
            Vector rtrs = new Vector();

            int pos = 0;

            int curP = 0;
            int curC = 0;
            int pLenRemain = -1;
            int cLenRemain = -1;

            // Build one for each run with the same style
            while(pos <= RunRawText.Length && curP < pStyles.Count && curC < cStyles.Count) {
                // Get the Props to use
                TextPropCollection pProps = (TextPropCollection)pStyles.Get(curP);
                TextPropCollection cProps = (TextPropCollection)cStyles.Get(curC);

                int pLen = pProps.GetCharactersCovered();
                int cLen = cProps.GetCharactersCovered();

                // Handle new pass
                bool freshSet = false;
                if(pLenRemain == -1 && cLenRemain == -1) { freshSet = true; }
                if(pLenRemain == -1) { pLenRemain = pLen; }
                if(cLenRemain == -1) { cLenRemain = cLen; }

                // So we know how to build the eventual run
                int RunLen = -1;
                bool pShared = false;
                bool cShared = false;

                // Same size, new styles - neither shared
                if(pLen == cLen && freshSet) {
                    RunLen = cLen;
                    pShared = false;
                    cShared = false;
                    curP++;
                    curC++;
                    pLenRemain = -1;
                    cLenRemain = -1;
                } else {
                    // Some sharing

                    // See if we are already in a shared block
                    if(pLenRemain < pLen) {
                        // Existing shared p block
                        pShared = true;

                        // Do we end with the c block, or either side of it?
                        if(pLenRemain == cLenRemain) {
                            // We end at the same time
                            cShared = false;
                            RunLen = pLenRemain;
                            curP++;
                            curC++;
                            pLenRemain = -1;
                            cLenRemain = -1;
                        } else if(pLenRemain < cLenRemain) {
                            // We end before the c block
                            cShared = true;
                            RunLen = pLenRemain;
                            curP++;
                            cLenRemain -= pLenRemain;
                            pLenRemain = -1;
                        } else {
                            // We end after the c block
                            cShared = false;
                            RunLen = cLenRemain;
                            curC++;
                            pLenRemain -= cLenRemain;
                            cLenRemain = -1;
                        }
                    } else if(cLenRemain < cLen) {
                        // Existing shared c block
                        cShared = true;

                        // Do we end with the p block, or either side of it?
                        if(pLenRemain == cLenRemain) {
                            // We end at the same time
                            pShared = false;
                            RunLen = cLenRemain;
                            curP++;
                            curC++;
                            pLenRemain = -1;
                            cLenRemain = -1;
                        } else if(cLenRemain < pLenRemain) {
                            // We end before the p block
                            pShared = true;
                            RunLen = cLenRemain;
                            curC++;
                            pLenRemain -= cLenRemain;
                            cLenRemain = -1;
                        } else {
//.........这里部分代码省略.........
开发者ID:hanwangkun,项目名称:npoi,代码行数:101,代码来源:TextRun.cs


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