Error message:
Argument 1: cannot convert from 'string' to 'int' in LIst
Error Description:
using System;
using System.Collections.Generic;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
List<int> objList = new List<int>();
objList.Add("Surya Infoware");
}
}
}
Error Solution:
using System;
using System.Collections.Generic;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
List<int> objList = new List<int>();
objList.Add(5);
Console.WriteLine("List value:"+objList[0].ToString());
Console.Read();
}
}
}
Output:
Post a comment
Please share your valuable feedback and share this article in social media.