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


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

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


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

示例1: Start

 // Use this for initialization
 void Start()
 {
     buffSpawnPositions = GetComponentsInChildren<Transform> ();
     System.Collections.Generic.List<Transform> list = new System.Collections.Generic.List<Transform> (buffSpawnPositions);
     list.Remove (transform);
     buffSpawnPositions = list.ToArray ();
 }
开发者ID:vankovilija,项目名称:everyoneisafriend,代码行数:8,代码来源:SpawnBuff.cs

示例2: 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

示例3: removeDocument

    public void removeDocument(GameObject toBeDelete)
    {
        System.Collections.Generic.List<GameObject> list = new System.Collections.Generic.List<GameObject>(documents);
        list.Remove(toBeDelete);
        documents = list.ToArray();

        if(documents.Length != 0)
            for(int i =0; i < documents.Length; i ++)
        {

            documents[i].transform.parent = fileModeObj.transform;

            documents[i].transform.localPosition = new Vector3(-0.2275543f +i*0.35f,0,-0.03671265f);
        }
    }
开发者ID:jiangkuo888,项目名称:ORP_beta,代码行数:15,代码来源:documentData.cs

示例4: solution0

 public int solution0(int[] A)
 {
     var l = new System.Collections.Generic.List<int>();
     for (int i = 0; i < A.Length; i++)
     {
         if (l.Contains(A[i]))
         {
             l.Remove(A[i]);
         }
         else
         {
             l.Add(A[i]);
         }
     }
     return l.FirstOrDefault();
 }
开发者ID:VictorNS,项目名称:Codility,代码行数:16,代码来源:Program.cs

示例5: CalculateDefines

    public string CalculateDefines(string addDefines, string removeDefines)
    {
        var addArray = addDefines.Trim(';').Split(';');
        var removeArray = removeDefines.Trim(';').Split(';');

        var list = new System.Collections.Generic.List<string>();
        foreach (var a in addArray)
        {
            if (!list.Contains(a))
            {
                list.Add(a);
            }
        }
        foreach (var r in removeArray)
        {
            if (list.Contains(r))
            {
                list.Remove(r);
            }
        }

        return string.Join(";", list.ToArray());
    }
开发者ID:marler8997,项目名称:Protobuild,代码行数:23,代码来源:GenerationFunctions.cs

示例6: OpList

 public OpList(Hub hub, string raw)
     : base(hub, raw)
 {
     int pos1;
     if ((pos1 = raw.IndexOf(" ")) != -1)
     {
         string tmp = raw.Substring(++pos1);
         char[] test = { '$', '$' };
     #if !COMPACT_FRAMEWORK
         ops = tmp.Split(test, System.StringSplitOptions.RemoveEmptyEntries); // command.Split("$$", StringSplitOptions.RemoveEmptyEntries);
     #else
         System.Collections.Generic.List<string> lst = new System.Collections.Generic.List<string>(tmp.Split(test));
         while (lst.Remove(string.Empty)) { }
         ops = lst.ToArray();
     #endif
     }
     IsValid = true;
 }
开发者ID:musakasim,项目名称:flowlib,代码行数:18,代码来源:hubnmdcmessages.cs

示例7: NickList

 public NickList(Hub hub, string raw)
     : base(hub, raw)
 {
     // $NickList <nick1>$$<nick2>$$<nick3>$$
     int pos1;
     if ((pos1 = raw.IndexOf(" ")) != -1)
     {
         string tmp = raw.Substring(pos1);
         char[] test = { '$', '$' };
     #if !COMPACT_FRAMEWORK
         nicks = tmp.Split(test, System.StringSplitOptions.RemoveEmptyEntries);
     #else
         System.Collections.Generic.List<string> lst = new System.Collections.Generic.List<string>(tmp.Split(test));
         while (lst.Remove(string.Empty)) { }
         nicks = lst.ToArray();
     #endif
         if (nicks.Length > 0)
             IsValid = true;
     }
 }
开发者ID:musakasim,项目名称:flowlib,代码行数:20,代码来源:hubnmdcmessages.cs

示例8: drawWindow

    void drawWindow(int id)
    {
        Class clazz = (Class)cuurentClassData.classes.GetValue (id);

        Rect boxRect = new Rect (0, 16, clazz.rect.width, clazz.rect.height - 16);
        GUI.Box (boxRect, "");

        if ((Event.current.button == 0) && (Event.current.type == EventType.MouseDown)) {
            focusWidowId = id;
            if (mode == mode_ref) {
                if (refModeClass != clazz) {
                    refModeTargetClass = clazz;
                }
            }
        }

        string iconPath = clazz.iconPath;
        Texture2D texIcon = null;
        Rect iconRect = new Rect (6, 22, 32, 32);
        if (iconPath != null) {
            texIcon = loadTexture (iconPath);
        }
        if (texIcon == null) {
            texIcon = texNoImage;
        }

        GUIStyle iconStyle = new GUIStyle (GUIStyle.none);
        iconStyle.normal.background = texIcon;
        if (GUI.Button (iconRect, "", iconStyle)) {
            string path = EditorUtility.OpenFilePanel ("Select Icon", "Assets", "");
            if (path != null) {
                Debug.Log (path);
                Debug.Log (Application.dataPath);
                if (Application.dataPath.Length < path.Length) {
                    path = path.Substring (Application.dataPath.Length);
                    Debug.Log (path);
                    char[] chTrims = {'/', '\\'};
                    path = path.TrimStart (chTrims);
                    Debug.Log (path);
                    clazz.iconPath = path;
                }
            }
        }

        Rect textRect = new Rect (iconRect.x + iconRect.width + 10, iconRect.y + 8, clazz.rect.width - (iconRect.x + iconRect.width + 8) - 20, 16);
        if (id == focusWidowId) {
            clazz.name = GUI.TextField (textRect, clazz.name);
        } else {
            GUI.Label (textRect, clazz.name);
        }

        float bx = clazz.rect.width - 18;

        if (id == focusWidowId) {
            GUIStyle style = new GUIStyle (GUIStyle.none);
            style.normal.background = texSuper;
            Rect btnRect = new Rect (0, 0, 16, 16);
            if (GUI.Button (btnRect, "", style)) {
                mode = mode_ref;
                refModeClass = clazz;
            }
            style.normal.background = texAdd;
            btnRect.x += 18;
            if (GUI.Button (btnRect, "", style)) {
                System.Collections.Generic.List<Attribute> attrList = new System.Collections.Generic.List<Attribute> (clazz.attributes);
                attrList.Add (new Attribute ());
                clazz.attributes = attrList.ToArray ();
            }
            style.normal.background = texRemove;
            btnRect.x = bx;
            btnRect.y = 0;
            if (GUI.Button (btnRect, "", style)) {
                System.Collections.Generic.List<Class> classList = new System.Collections.Generic.List<Class> (cuurentClassData.classes);
                classList.Remove (clazz);
                cuurentClassData.classes = classList.ToArray ();
            }
        }

        //if(focusWidowId == id){

        //}

        for (int index = 0; index < clazz.attributes.Length; index++) {
            Attribute attr = (Attribute)clazz.attributes.GetValue (index);
            float width = clazz.rect.width;
            float nwidth = 60;
            float twidth = 60;
            float y = 60 + 18 * index;

            Rect irect = new Rect (12, y, 16, 16);
            Rect nrect = new Rect (irect.x + irect.width + 4, y, nwidth, 16);
            Rect crect = new Rect (nrect.x + nwidth, y, 8, 16);
            Rect trect = new Rect (crect.x + crect.width, y, twidth, 16);

            texIcon = null;
            string attrIconPath = attr.iconPath;
            Texture2D attrTexIcon = null;
            if (attrIconPath != null) {
                texIcon = loadTexture (attrIconPath);
            }
//.........这里部分代码省略.........
开发者ID:mikamikuh,项目名称:UnityClassDiagram,代码行数:101,代码来源:ClassDiagramEditor.cs

示例9: GetSearchedGroups

    private UserGroupData[] GetSearchedGroups()
    {
        ValidatePermissions();

            //set paging size
            Ektron.Cms.PagingInfo pageInfo = new Ektron.Cms.PagingInfo();
            System.Collections.Generic.List<Ektron.Cms.UserGroupData> groupList = new System.Collections.Generic.List<Ektron.Cms.UserGroupData>();
            int i = 0;
            int j;
            pageInfo.CurrentPage = _CurrentPage + 1;
            pageInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize;
            UserGroupData[] userGroupData = null;

            Ektron.Cms.Common.Criteria<Ektron.Cms.Common.UserGroupProperty> userGroupCriteria = new Ektron.Cms.Common.Criteria<Ektron.Cms.Common.UserGroupProperty>();
            userGroupCriteria.PagingInfo = pageInfo;
            userGroupCriteria.AddFilter(Ektron.Cms.Common.UserGroupProperty.Name, Ektron.Cms.Common.CriteriaFilterOperator.Contains, _SearchText);
            userGroupCriteria.AddFilter(Ektron.Cms.Common.UserGroupProperty.IsMembershipGroup, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _IsMembership);

            string assignedUser = (string) hdnAssignedUserGroupIds.Value;
            _AssignedUsers = assignedUser.Split(",".ToCharArray());
            groupList = _UserApi.GetUserGroupList(userGroupCriteria);

            if (groupList.Count > 0)
            {
                while (i < groupList.Count)
                {
                    for (j = 0; j <= _AssignedUsers.Length - 2; j++)
                    {
                        if (Convert.ToInt64(_AssignedUsers[j]) == groupList[i].GroupId)
                        {
                            groupList.Remove(groupList[i]);
                        }
                        if (groupList.Count == 0)
                        {
                            goto endOfWhileLoop;
                        }
                    }
                    i++;
                }
        endOfWhileLoop:
                if (groupList.Count == 1)
                {
                    userGroupData = new UserGroupData[groupList.Count + 1];
                }
                else
                {
                    userGroupData = new UserGroupData[groupList.Count - 1 + 1];
                }
                i = 0;

                //isAssignedUser = isAssigned(_UserGroupData, userDataList)
                //If (isAssignedUser = False) Then
                foreach (UserGroupData groupData in groupList)
                {
                    userGroupData[i] = new UserGroupData();
                    userGroupData[i].GroupId = groupData.GroupId;
                    userGroupData[i].GroupName = groupData.GroupName;
                    userGroupData[i].UserId = -1;
                    userGroupData[i].IsMemberShipUser = groupData.IsMemberShipGroup;
                    i++;
                }
                //End If
            }
            _TotalPages = pageInfo.TotalPages;
            return userGroupData;
    }
开发者ID:jaytem,项目名称:minGit,代码行数:66,代码来源:selectpermissions.ascx.cs

示例10: MergeFeedItems

        static public Microsoft.Samples.FeedSync.FeedItemNode MergeFeedItems(Microsoft.Samples.FeedSync.Feed i_Feed, Microsoft.Samples.FeedSync.FeedItemNode i_LocalFeedItemNode, Microsoft.Samples.FeedSync.FeedItemNode i_IncomingFeedItemNode)
        {
            Microsoft.Samples.FeedSync.FeedItemNode ImportedLocalFeedItemNode = i_Feed.ImportFeedItemNode(i_LocalFeedItemNode);
            Microsoft.Samples.FeedSync.FeedItemNode ImportedIncomingFeedItemNode = i_Feed.ImportFeedItemNode(i_IncomingFeedItemNode);

            System.Collections.Generic.List<Microsoft.Samples.FeedSync.FeedItemNode> LocalFeedItemNodeList = new System.Collections.Generic.List<Microsoft.Samples.FeedSync.FeedItemNode>();
            LocalFeedItemNodeList.Add(ImportedLocalFeedItemNode);

            System.Collections.Generic.List<Microsoft.Samples.FeedSync.FeedItemNode> IncomingFeedItemNodeList = new System.Collections.Generic.List<Microsoft.Samples.FeedSync.FeedItemNode>();
            IncomingFeedItemNodeList.Add(ImportedIncomingFeedItemNode);

            System.Diagnostics.Debug.Assert(ImportedLocalFeedItemNode.SyncNode.NoConflicts == ImportedIncomingFeedItemNode.SyncNode.NoConflicts);

            //  Perform conflict feed item processing (if necessary)
            if (!ImportedLocalFeedItemNode.SyncNode.NoConflicts)
            {
                LocalFeedItemNodeList.AddRange(ImportedLocalFeedItemNode.SyncNode.ConflictFeedItemNodes);
                IncomingFeedItemNodeList.AddRange(ImportedIncomingFeedItemNode.SyncNode.ConflictFeedItemNodes);
            }

            ImportedLocalFeedItemNode.SyncNode.RemoveAllConflictItemNodes();
            ImportedIncomingFeedItemNode.SyncNode.RemoveAllConflictItemNodes();

            Microsoft.Samples.FeedSync.FeedItemNode WinnerFeedItemNode = null;
            System.Collections.Generic.List<Microsoft.Samples.FeedSync.FeedItemNode> MergedFeedItemNodeList = new System.Collections.Generic.List<Microsoft.Samples.FeedSync.FeedItemNode>();

            #region Process local feeditem node list

            //  Iterate local items first, looking for subsumption
            foreach (Microsoft.Samples.FeedSync.FeedItemNode LocalFeedItemNode in LocalFeedItemNodeList.ToArray())
            {
                bool Subsumed = false;

                foreach (Microsoft.Samples.FeedSync.FeedItemNode IncomingFeedItemNode in IncomingFeedItemNodeList.ToArray())
                {
                    if (LocalFeedItemNode.IsSubsumedByFeedItemNode(IncomingFeedItemNode))
                    {
                        Subsumed = true;
                        break;
                    }
                }

                if (Subsumed)
                {
                    LocalFeedItemNodeList.Remove(LocalFeedItemNode);
                    continue;
                }

                MergedFeedItemNodeList.Add(LocalFeedItemNode);

                if (WinnerFeedItemNode == null)
                    WinnerFeedItemNode = LocalFeedItemNode;
                else
                {
                    Microsoft.Samples.FeedSync.FeedItemNode.CompareResult CompareResult = Microsoft.Samples.FeedSync.FeedItemNode.CompareFeedItems
                        (
                        WinnerFeedItemNode, 
                        LocalFeedItemNode
                        );

                    if (Microsoft.Samples.FeedSync.FeedItemNode.CompareResult.ItemNode1Newer != CompareResult)
                        WinnerFeedItemNode = LocalFeedItemNode;
                }
            }

            #endregion

            #region Process incoming feeditem node list

            //  Iterate incoming items next, looking for subsumption
            foreach (Microsoft.Samples.FeedSync.FeedItemNode IncomingFeedItemNode in IncomingFeedItemNodeList.ToArray())
            {
                bool Subsumed = false;

                foreach (Microsoft.Samples.FeedSync.FeedItemNode LocalFeedItemNode in LocalFeedItemNodeList.ToArray())
                {
                    if (IncomingFeedItemNode.IsSubsumedByFeedItemNode(LocalFeedItemNode))
                    {
                        Subsumed = true;
                        break;
                    }
                }

                if (Subsumed)
                {
                    IncomingFeedItemNodeList.Remove(IncomingFeedItemNode);
                    continue;
                }

                MergedFeedItemNodeList.Add(IncomingFeedItemNode);

                if (WinnerFeedItemNode == null)
                    WinnerFeedItemNode = IncomingFeedItemNode;
                else
                {
                    Microsoft.Samples.FeedSync.FeedItemNode.CompareResult CompareResult = Microsoft.Samples.FeedSync.FeedItemNode.CompareFeedItems
                        (
                        WinnerFeedItemNode,
                        IncomingFeedItemNode
                        );
//.........这里部分代码省略.........
开发者ID:xxjeng,项目名称:nuxleus,代码行数:101,代码来源:FeedItemNode.cs


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