Solved C# edit list

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

elodia

Newbie
Full Member
Aug 11, 2016
41
323
1
hi all :)
can someone tell me please how can i print and edit the "holdAll" list that i made :D
i google for some time but i only found for default list like string, that was easy, but when list have more value types i m confused :p

C++:
  public List<hold> holdAll = new List<hold>();
        
        public class hold
            {
            public string name;
            public float x;
            public float y;
            public float z;

            public hold(string _name,float _x, float _y, float _z)
                {
                string name = _name;
                float x = _x;
                float y = _y;
                float z = _z;

                }
        }
        public void addToList()
        {                     
            holdAll.Add(new hold("Hello",1,2,3));
            holdAll.Add(new hold("Robert de Niro",4,5,6));
         
        }
 

Boboo99

Scrub
Dank Tier VIP
Fleep Tier Donator
Feb 20, 2016
468
12,178
44
C#:
 public List<hold> holdAll = new List<hold>();
        
        public class hold
            {
            public string name;
            public float x;
            public float y;
            public float z;

            public hold(string _name,float _x, float _y, float _z)
                {
                string name = _name;
                float x = _x;
                float y = _y;
                float z = _z;

                }
			public void Print() //just method to print all the data of the object
			{
				Console.WriteLine(name + "||" + x + ";" + y ";" + z);
			}
        }
		
        public void addToList()
        {                     
            holdAll.Add(new hold("Hello",1,2,3));
            holdAll.Add(new hold("Robert de Niro",4,5,6));
        }
		
		public void printAll() //prints all objects in the holdAll collection
		{
			foreach(hold h in holdAll)
				h.Print();
		}
		
		public void editByName(string name,hold newHold) //searches an entry by its name and assings it a new value
		{
			holdAll.Where(x => x.name == name).ToList().First() = newHold;
		}
		
		public void editById(int id,hold newHold) //searches an entry by its id and assings it a new value
		{
			holdAll[id] = newHold;
		}
		
		public void normalEditing()
		{
			//Any member of holdAll
			holdAll[0].name = "Test"; //This will change the first entry of the holdAll list , so the hold's object name is changed
			holdAll[1].y = 7; //This willl change the second entry of the holdAll list, so the hold's object y variable is changed.
		}
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods