Some One Help In C#
Print --below list
List
// Add items using Add method
AuthorList.Add("Name :Mahesh Chand,Adress:Hyd");
AuthorList.Add("Name:Praveen Kumar,Adress:Pune");
AuthorList.Add(" ");
AuthorList.Add("Name:Nipun Tomar,Adress:Delhi");
AuthorList.Add("Name:Dinesh Beniwal");
And I want Print Author Name
Output:
Mahesh Chand
Praveen Kuma
Nipun Tomar
and City
Output:
Hyd
Pune
Delhi

Satya KarkiPosted Oct 11, 2021, 4:36 AM
Anu ViswanPosted Oct 10, 2021, 5:01 AM
Sachin SinghPosted Oct 9, 2021, 2:47 PM
> SplitNameAndAddress(List list)
>();
Bohdan StupakPosted Oct 9, 2021, 1:36 PM
Praveen Kumar
Nipun Tomar
Hyd
Pune
Delhi
Vishnu VPosted Oct 8, 2021, 12:07 PM
public class Program AuthorList = new List();
{
public static void Main()
{
List
// Add items using Add method
AuthorList.Add("Name :Mahesh Chand,Adress:Hyd");
AuthorList.Add("Name:Praveen Kumar,Adress:Pune");
AuthorList.Add("Name:Nipun Tomar,Adress:Delhi");
//AuthorName
Console.WriteLine("Output Author Name and Adress");
foreach (string author in AuthorList)
{
var authorName = author.Split(Convert.ToChar(":"))[1];
var authorCity = author.Split(Convert.ToChar(":"))[2];
Console.WriteLine(authorName);
Console.WriteLine(authorCity);
}
}
}
Ouput;
Output Author Name and Adress
Mahesh Chand,Adress
Hyd
Praveen Kumar,Adress
Pune
Nipun Tomar,Adress
Delhi
Still not solved my quetion
Ganesan CPosted Oct 8, 2021, 11:20 AM
Sachin SinghPosted Oct 8, 2021, 8:55 AM