I want to show list items in Number vice and if I say number 5 it should show number 5th item in list box how to do ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I want to show list items in Number vice and if I say number 5 it should show number 5th item in list box how to do ?

I want to show list items in Number vice and if I say number 5 it should show number 5th item in list box how to do ?

11th Apr 2017, 3:12 PM
sugnan cm
sugnan cm - avatar
5 Answers
+ 8
I hope, you mean this, correct me if not, I try to help you, if I can. :D using System; using System.Collections.Generic; class SomeThing { static void Main() { List<string> list = new List<string>(){"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}; Console.Write("Element Index: "); int x = Convert.ToInt16(Console.ReadLine()); Console.WriteLine(x+"."+list[x-1]); } }
11th Apr 2017, 4:02 PM
Ákos Nagy
Ákos Nagy - avatar
+ 7
Sorry, if I misunderstood your question(my english knowledge is terrible), but: using System; using System.Collections.Generic; class program { static void Main() { List<int> _list = new List<int>{1,2,3,4,5,6,7,8,9,10}; Console.Write("Element Number: "); int x = Convert.ToInt16(Console.ReadLine()); string value = _list[x]-1;// -1 not necessary } }
11th Apr 2017, 3:38 PM
Ákos Nagy
Ákos Nagy - avatar
+ 1
Bro let me ask with example : Lets take list Items a b c d e I want to answer that it should come Like 1.a 2.b 3.c
11th Apr 2017, 3:25 PM
sugnan cm
sugnan cm - avatar
0
okay bro tq
11th Apr 2017, 4:03 PM
sugnan cm
sugnan cm - avatar
0
akos nagy bro No We should add increment i think . to show list items in Number vice versa
11th Apr 2017, 4:04 PM
sugnan cm
sugnan cm - avatar