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


C# System.Collections.Generic.List.RemoveAt方法代码示例

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


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

示例1: ListRNDTest

        public void ListRNDTest()
        {
            var controlList = new System.Collections.Generic.List<int>();
            var testList = new MyList<int>();

            var r = new System.Random();
            for (int i = 0; i < 1000; i++)
            {
                var next = r.Next();
                controlList.Add(next);
                testList.Add(next);
                Assert.AreEqual(controlList.Count, testList.Count);
            }
            for (int i = 0; i < 1000; i++)
            {
                Assert.IsTrue(testList.IndexOf(controlList[i]) == i);
            }
            for (int i = 0; i < controlList.Count; i++)
            {
                if (r.Next() < int.MaxValue / 2)
                {
                    testList.RemoveAt(i);
                    controlList.RemoveAt(i);
                }
                else
                {
                    var newItem = r.Next();
                    testList.Insert(i, newItem);
                    controlList.Insert(i, newItem);
                }
            }
            Assert.AreEqual(controlList.Count, testList.Count);

            foreach (var itm in controlList){
                Assert.IsTrue(testList.Contains(itm));
            }
            for (int i = 0; i < controlList.Count / 2; i++ )
            {
                var e = controlList[i];
                controlList.Remove(e);
                testList.Remove(e);
            }
            int[] controllarray = new int[controlList.Count+1];
            int[] testArray = new int[testList.Count+1];
            controllarray[0] = r.Next();
            testArray[0] = controllarray[0];
            controlList.CopyTo(controllarray, 1);
            testList.CopyTo(testArray, 1);

            var q = from a in testArray
                    join b in controllarray on a equals b
                    select a;

            Assert.IsTrue(testArray.Length == controllarray.Length && q.Count() == controllarray.Length);
            controlList.Clear();
            testList.Clear();
            Assert.AreEqual(controlList.Count,testList.Count);
        }
开发者ID:bdjewkes,项目名称:LearnMeACSharp,代码行数:58,代码来源:MainTests.cs

示例2: KeepLastXSubDirs

        /// <summary>
        /// Keeps the last X sub dirs.
        /// </summary>
        /// <param name="targetFolder">The target folder.</param>
        /// <param name="amountToKeep">The amount to keep.</param>
        /// <param name="buildLogDirectory">The build log directory.</param>
        private void KeepLastXSubDirs(string targetFolder, int amountToKeep, string buildLogDirectory)
        {
            Log.Trace("Deleting Subdirs of {0}", targetFolder);

            var sortNames = new System.Collections.Generic.List<string>();
            const string dateFormat = "yyyyMMddHHmmssffffff";

            foreach (var folder in Directory.GetDirectories(targetFolder))
            {
                if (folder != buildLogDirectory)
                    sortNames.Add(Directory.GetCreationTime(folder).ToString(dateFormat, CultureInfo.CurrentCulture) + folder);
            }

            sortNames.Sort();
            var amountToDelete = sortNames.Count - amountToKeep;
            for (var i = 0; i < amountToDelete; i++)
            {
                DeleteFolder(sortNames[0].Substring(dateFormat.Length));
                sortNames.RemoveAt(0);
            }
        }
开发者ID:KevinFernandes,项目名称:CCNetEnhancedBuildPublisher,代码行数:27,代码来源:EnhancedBuildPublisher.cs

示例3: LoadMap


//.........这里部分代码省略.........
                                        f.ControlBox = false;
                                        f.MinimizeBox = false;
                                        f.MaximizeBox = false;
                                        f.FormBorderStyle = FormBorderStyle.FixedSingle;
                                        f.Size = new System.Drawing.Size(700, 60);
                                        f.StartPosition = FormStartPosition.CenterScreen;
                                        Label lbl = new Label();
                                        lbl.Dock = DockStyle.Fill;
                                        lbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                                        #endregion
                                        f.Show();
                                        f.Controls.Add(lbl);

                                        foreach (string filename in ofd.FileNames)
                                        {
                                            f.Text = filename;
                                            lbl.Text = "Unknowns remaining: " + indexes.Count.ToString();
                                            f.Focus();
                                            f.Refresh();

                                            // Load clean base map
                                            Map tempMap = Map.LoadFromFile(filename);
                                            if (tempMap == null)
                                                continue;

                                            /*
                                            // Match all Idents and use original name
                                            for (int z = 0; z < tempMap.MetaInfo.Ident.Length; z++)
                                                for (int y = 0; y < indexes.Count; y++)
                                                    if (tempMap.MetaInfo.Ident[z] == MetaInfo.Ident[indexes[y]])
                                                    {
                                                        FileNames.Name[indexes[y]] = tempMap.FileNames.Name[z];
                                                        // No longer need these, so remove to speed up future searches.
                                                        indexes.RemoveAt(y);
                                                        offsets.RemoveAt(y);
                                                        break;
                                                    }
                                             */

                                            // Match all tags with same length, tag type & name lengths
                                            for (int z = 0; z < tempMap.MetaInfo.Size.Length; z++)
                                                for (int y = 0; y < indexes.Count; y++)
                                                    if (tempMap.MetaInfo.Size[z] == MetaInfo.Size[indexes[y]]
                                                        && tempMap.MetaInfo.TagType[z] == MetaInfo.TagType[indexes[y]]
                                                        && tempMap.FileNames.Name[z].Length == FileNames.Name[indexes[y]].Length)
                                                    {
                                                        FileNames.Name[indexes[y]] = tempMap.FileNames.Name[z];
                                                        // No longer need these, so remove to speed up future searches.
                                                        indexes.RemoveAt(y);
                                                        offsets.RemoveAt(y);
                                                        break;
                                                    }

                                            tempMap.CloseMap();
                                        }
                                        f.Hide();
                                        f.Dispose();
                                    }
                                    if (indexes.Count > 0)
                                        if (MessageBox.Show("There are still " + indexes.Count.ToString() + " unknowns.\n Would you like to try retrieving data from another map?", "Check another base map?", MessageBoxButtons.YesNo) == DialogResult.No)
                                            break;
                                } while (indexes.Count > 0);

                                // For left-over tags, try something else
                                for (int y = 0; y < indexes.Count; y++)
                                {
开发者ID:troymac1ure,项目名称:Entity,代码行数:67,代码来源:Map.cs

示例4: CheckForUpdates

        /// <summary>
        /// Esegue il controllo sulle versioni e lancia il programma di aggiornamento.
        /// </summary>
        private void CheckForUpdates()
        {
            string theVersion = null;
            if (this.myVersion == null)
            {
                var myDir = System.Reflection.Assembly.GetExecutingAssembly().Location;
                myDir = System.IO.Path.GetDirectoryName(myDir);
                var myFiles = System.IO.Directory.GetFiles(myDir);
                string myManifest = null;
                foreach (var f in myFiles)
                {
                    if (f.ToLower().EndsWith(".vsixmanifest"))
                    {
                        myManifest = f;
                        break;
                    }
                }

                if (myManifest == null)
                {
                    return;
                }

                using (var theFile = System.IO.File.OpenRead(myManifest))
                {
                    var xml = System.Xml.XmlReader.Create(theFile);
                    xml.ReadToFollowing("Version");
                    theVersion = xml.ReadString();
                    xml.Close();
                }

                if (theVersion == null)
                {
                    return;
                }

                this.myVersion = new Version(theVersion);
                if (!this.myVersion.IsValid())
                {
                    this.myVersion = null;
                    return;
                }
            }

            if (System.IO.Directory.Exists(@"S:\AlmaStyleFix\Updates"))
            {
                var files = new System.Collections.Generic.List<string>();
                files.AddRange(System.IO.Directory.GetFiles(@"S:\AlmaStyleFix\Updates"));
                for (int i = 0; i < files.Count; i++)
                {
                    if (!files[i].EndsWith(".vsix"))
                    {
                        files.RemoveAt(i--);
                    }
                }

                if (files.Count > 0)
                {
                    string fileToUpdate = null;
                    foreach (var f in files)
                    {
                        var theFileVersion = new Version(f);
                        if (!theFileVersion.IsValid())
                        {
                            continue;
                        }

                        if (theFileVersion > this.myVersion)
                        {
                            fileToUpdate = f;
                            break;
                        }
                    }

                    if (fileToUpdate != null)
                    {
                        if (this.Question(this.locRM.GetString("Update")))
                        {
                            var commonFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86);
                            commonFolder += "\\microsoft shared\\MSEnv\\";
                            var launcher = commonFolder + "VSLauncher.exe";

                            var pi = new System.Diagnostics.ProcessStartInfo();
                            pi.FileName = launcher;
                            pi.Arguments = fileToUpdate;

                            var p = new System.Diagnostics.Process();

                            p.StartInfo = pi;
                            p.Start();
                        }
                    }
                }
            }
        }
开发者ID:AlmatoolboxCE,项目名称:AlmaStyleFix,代码行数:98,代码来源:AlmaStyleFixPackage.cs

示例5: Main

 public static void Main()
 {
     ss_matrix M = ss_matrix.Create(5, 4);
     ss_matrix N = ss_matrix.Create(4, 5);
     ss_matrix P = ss_matrix.Create(5, 4);
     for (int i = 0; i < M.rownumber; i++)
     {
         for (int j = 0; j < M.colnumber; j++)
         {
             M[i, j] = 1.00;
             N[j, i] = 1;
             P[i, j] = 1;
         }
     }
     //M = M + N;
     ss_matrix O = ss_matrix.Create(5, 5);
     //ss_matrix S = M * O;
     O = M * N;
     System.Console.WriteLine(O);
     System.Console.WriteLine(M == P);
     P[4, 3] = 3;
     System.Console.WriteLine(M == P);
     System.Console.WriteLine(M);
     System.Console.WriteLine(P);
     //double x = P[5, 3];
     //P[5, 3] = 5;
     ss_matrix Q = ss_matrix.Create(-1, 5);
     System.Collections.Generic.List<ss_matrix> mySSlist = new System.Collections.Generic.List<ss_matrix>();
     for (int i = 0; i < 2147483647; i++)
     {
         int ii = 0;
         try
         {
             mySSlist.Add(ss_matrix.Create(2147483647, 2147483647));
         }
         catch (System.OutOfMemoryException e)
         {
             System.Console.WriteLine("Kivetel a tombnel. A ciklus {0}. lepeseben. {1}", i, e.Message);
             mySSlist[ii].Dispose();
             mySSlist.RemoveAt(ii);
             ii++;
         }
     }
     ss_matrix R = ss_matrix.Create(2147483647, 2147483647);
     System.Console.WriteLine(R[2147483646, 2147483646]);
 }
开发者ID:2esSergei,项目名称:ss_math_structs,代码行数:46,代码来源:Program.cs

示例6: TestProjects_by_name

        public void TestProjects_by_name()
        {
            System.Collections.Generic.List<TestProject> listOfProjects =
                new System.Collections.Generic.List<TestProject>();
            listOfProjects.Add(
                FakeTestLinkFactory.GetTestProject(
                    "project1",
                    "prj1",
                    string.Empty));
            listOfProjects.Add(
                FakeTestLinkFactory.GetTestProject(
                    "project2",
                    "prj2",
                    string.Empty));
            listOfProjects.Add(
                FakeTestLinkFactory.GetTestProject(
                    "project3",
                    "prj3",
                    string.Empty));
            
            System.Collections.Generic.List<TestPlan> listOfTestPlans =
                new System.Collections.Generic.List<TestPlan>();
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan1",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[0].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan4",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    111)); //listOfProjects[2].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan2",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[1].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan3",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[2].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan5",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    927));
            
            listOfTestPlans.RemoveAt(4);
            listOfTestPlans.RemoveAt(1);
//cmdlet.WriteTrace(cmdlet, "TestProjects_by_name: 0001");
            System.Collections.Generic.List<TestPlan> resultList =
                getTestPlansByProjectName(
                    listOfProjects[0],
                    (new string[3]{ listOfProjects[0].name, listOfProjects[1].name, listOfProjects[2].name }),
                    listOfTestPlans, 
                    false, 
                    false);
//cmdlet.WriteTrace(cmdlet, "TestProjects_by_name: 0002");
            Assert.AreEqual<System.Collections.Generic.List<TestPlan>>(
            //Assert.AreEqual<Meyn.TestLink.TestPlan>(
                (new System.Collections.Generic.List<TestPlan>()),
                resultList);
//cmdlet.WriteTrace(cmdlet, "TestProjects_by_name: 0003");
        }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:80,代码来源:GetTestPlansTestFixture.cs

示例7: TestProject_not_specified

        public void TestProject_not_specified()
        {
            System.Collections.Generic.List<TestProject> listOfProjects =
                new System.Collections.Generic.List<TestProject>();
            listOfProjects.Add(
                FakeTestLinkFactory.GetTestProject(
                    "project01",
                    "prj",
                    string.Empty));
            listOfProjects.Add(
                FakeTestLinkFactory.GetTestProject(
                    "project02",
                    "prj",
                    string.Empty));
            
            System.Collections.Generic.List<TestPlan> listOfTestPlans =
                new System.Collections.Generic.List<TestPlan>();
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan 01",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[0].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan 02",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[1].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan 03",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[0].id));
            
            System.Collections.Generic.List<TestPlan> resultList =
                getTestPlansFromProjectsInPipeline(listOfProjects, listOfTestPlans, false, true);
            
            listOfTestPlans.RemoveAt(1);

            Assert.AreEqual<System.Collections.Generic.List<TestPlan>>(
            //Assert.AreEqual<Meyn.TestLink.TestPlan>(
                listOfTestPlans,
                resultList);
        }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:52,代码来源:GetTestPlansTestFixture.cs

示例8: TestProjects_from_pipeline

        public void TestProjects_from_pipeline()
        {
            System.Collections.Generic.List<TestProject> listOfProjects =
                new System.Collections.Generic.List<TestProject>();
            listOfProjects.Add(
                FakeTestLinkFactory.GetTestProject(
                    "project1",
                    "prj1",
                    string.Empty));
            listOfProjects.Add(
                FakeTestLinkFactory.GetTestProject(
                    "project2",
                    "prj2",
                    string.Empty));
            listOfProjects.Add(
                FakeTestLinkFactory.GetTestProject(
                    "project3",
                    "prj3",
                    string.Empty));
            
            System.Collections.Generic.List<TestPlan> listOfTestPlans =
                new System.Collections.Generic.List<TestPlan>();
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan1",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[0].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan4",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    111)); //listOfProjects[2].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan2",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[1].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan3",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[2].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan5",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    927));
            
            System.Collections.Generic.List<TestPlan> resultList =
                getTestPlansFromProjectsInPipeline(listOfProjects, listOfTestPlans, false, false);
            
            listOfTestPlans.RemoveAt(4);
            listOfTestPlans.RemoveAt(1);

            Assert.AreEqual<System.Collections.Generic.List<TestPlan>>(
            //Assert.AreEqual<Meyn.TestLink.TestPlan>(
                listOfTestPlans,
                resultList);
        }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:74,代码来源:GetTestPlansTestFixture.cs

示例9: GetTLProject_with_params_three_projects_by_id

        public void GetTLProject_with_params_three_projects_by_id()
        {

            string[] projectNames = { "project01", "project02", "project03" };

            System.Collections.Generic.List<TestProject> list =
                new System.Collections.Generic.List<TestProject>();
            list.Add(
                FakeTestLinkFactory.GetTestProject(
                    projectNames[0],
                    "prj1",
                    string.Empty));
            list.Add(
                FakeTestLinkFactory.GetTestProject(
                    "project04",
                    "prj4",
                    string.Empty));
            list.Add(
                FakeTestLinkFactory.GetTestProject(
                    projectNames[1],
                    "prj2",
                    string.Empty));
            list.Add(
                FakeTestLinkFactory.GetTestProject(
                    projectNames[2],
                    "prj3",
                    string.Empty));
            
            int[] projectIds =
                { list[0].id, list[2].id, list[3].id };
            
            System.Collections.Generic.List<TestProject> resultList =
                getProject(list, projectNames, false);
            
            list.RemoveAt(1);
            
            Assert.AreEqual<int>(
                projectIds[0],
                resultList[0].id);
            
            Assert.AreEqual<int>(
                projectIds[1],
                resultList[1].id);
            
            Assert.AreEqual<int>(
                projectIds[2],
                resultList[2].id);
        }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:48,代码来源:GetProjectTestFixture.cs

示例10: GetTLProject_with_params_one_project_by_id

 public void GetTLProject_with_params_one_project_by_id()
 {
     string projectName = "project01";
     
     System.Collections.Generic.List<TestProject> list =
         new System.Collections.Generic.List<TestProject>();
     list.Add(
         FakeTestLinkFactory.GetTestProject(
             "project00",
             "prj0",
             string.Empty));
     list.Add(
         FakeTestLinkFactory.GetTestProject(
             projectName,
             "prj1",
             string.Empty));
     list.Add(
         FakeTestLinkFactory.GetTestProject(
             "project02",
             "prj2",
             string.Empty));
     
     System.Collections.Generic.List<int> projectIds =
         new System.Collections.Generic.List<int>();
     projectIds.Add(list[1].id);
     
     System.Collections.Generic.List<TestProject> resultList =
         getProject(list, (new string[]{ projectName }), false);
     
     list.RemoveAt(2);
     list.RemoveAt(0);
     
     Assert.AreEqual<int>(
         projectIds[0],
         resultList[0].id);
 }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:36,代码来源:GetProjectTestFixture.cs

示例11: TestProjects_from_pipeline_two_names

        public void TestProjects_from_pipeline_two_names()
        {
            System.Collections.Generic.List<TestProject> listOfProjects =
                new System.Collections.Generic.List<TestProject>();
            listOfProjects.Add(
                FakeTestLinkFactory.GetTestProject(
                    "project01",
                    "prj1",
                    string.Empty));
            listOfProjects.Add(
                FakeTestLinkFactory.GetTestProject(
                    "project02",
                    "prj2",
                    string.Empty));
            listOfProjects.Add(
                FakeTestLinkFactory.GetTestProject(
                    "project03",
                    "prj3",
                    string.Empty));
            
            System.Collections.Generic.List<TestPlan> listOfTestPlans =
                new System.Collections.Generic.List<TestPlan>();
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan 01",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[0].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan 02",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[0].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan 03",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[0].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan 04",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[2].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan 02",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[2].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan 02",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    listOfProjects[1].id));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan 02",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    111));
            listOfTestPlans.Add(
                FakeTestLinkFactory.GetTestPlan(
                    "testplan 03",
                    "notes",
                    true, // active
                    true, // is_public
                    true, // open
                    222));
            
            System.Collections.Generic.List<TestPlan> resultList =
                getTestPlansFromProjectsInPipelineByName(listOfProjects, listOfTestPlans, (new string[]{ "testplan 02", "testplan 04" }), false, false);

            listOfTestPlans.RemoveAt(7);
            listOfTestPlans.RemoveAt(6);
            listOfTestPlans.RemoveAt(2);
            listOfTestPlans.RemoveAt(0);
            
            Assert.AreElementsSameIgnoringOrder<Meyn.TestLink.TestPlan>(
                listOfTestPlans,
                resultList);
        }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:99,代码来源:GetTestPlanTestFixture.cs

示例12: RemoveItem

    //Removed an item from the inventory (IT DOESN'T DROP IT).
    public void RemoveItem( Transform Item  )
    {
        System.Collections.Generic.List<Transform> newContents = new System.Collections.Generic.List<Transform>(Contents);

        int index=0;
        bool shouldend=false;

        foreach(Transform i in newContents) //Loop through the Items in the Inventory:
        {
            if(i == Item) //When a match is found, remove the Item.
            {
                newContents.RemoveAt(index);
                shouldend=true;
                //No need to continue running through the loop since we found our item.
            }
            index++;

            if(shouldend) //Exit the loop
            {
                Contents=newContents.ToArray();
                if (DebugMode)
                {
                    Debug.Log(Item.name+" has been removed from inventroy");
                }
                if (this.GetComponent<InventoryDisplay>() != null)
                {
                    this.GetComponent<InventoryDisplay>().UpdateInventoryList();
                }
                return;
            }
        }
    }
开发者ID:jiangkuo888,项目名称:ORP_beta,代码行数:33,代码来源:InventoryNew.cs

示例13: Human

        public static string Human(string data, string[] words, string separator) {
            System.Diagnostics.Debug.Assert((data != null && data.Length > 0), "The data parameter is null/empty!");

            var target = 3;
            if (data.Length > 15)
                target += 1;
            if (data.Length > 250)
                target += 1;
            if (data.Length > 1000)
                target += 1;

            var bytes = System.Text.Encoding.Default.GetBytes(data);
            var length = bytes.Length;

            var chunk_size = length / target;
            var ix = 0;
            var segments = new System.Collections.Generic.List<byte>();
            var inner = 0;
            var sum = 0;
            while (ix < length) {
                sum += bytes[ix];
                inner++;
                if (inner == chunk_size) {
                    var offset = sum % 256;
                    segments.Add((byte)offset);
                    sum = 0;
                    inner = 0;
                }
                ix++;
            }

            if (segments.Count > target)
                segments.RemoveAt(segments.Count - 1);


            var buffer = new System.Text.StringBuilder();
            for (var i = 0; i < segments.Count; i++) {
                ix = (int)segments[i];
                var word = words[ix];
                if (buffer.Length == 0)
                    buffer.Append(word);
                else
                    buffer.Append(separator + word);
            }
            var result = buffer.ToString();
            return result;
        }
开发者ID:MagicWishMonkey,项目名称:aoi.net,代码行数:47,代码来源:Hash.cs


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