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 ?
5 Antworten
+ 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]);
}
}
+ 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
}
}
+ 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
0
okay bro tq
0
akos nagy bro No We should add increment i think . to show list items in Number vice versa