The type or namespace name 'List' could not be found in C#

Error Message:

The type or namespace name 'List<>' could not be found (are you missing a using directive or an assembly reference?)


Error Description:

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> objList = new List<int>();
        }
    }
}

Error Solution:

You need to add using System.Collections.Generic;
 Namespace to get List<int>
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> objList = new List<int>();
        }
    }
}


Output:

Program compiled successfully. 
Share this post :

Post a comment

Please share your valuable feedback and share this article in social media.

 
Support : Ranga Rajesh Kumar
Copyright © 2019. Error Solution - All Rights Reserved
Site Designed by Ranga Rajesh Kumar