Q:

Is there performance issue when using resource inside the loop

I'm calling an ExternalApi in a parallel loop which instantiates a new HttpClient object for each item in the loop. Is that creating needless objects? Should I find a way so it doesn't have to create a new HttpClient instance for each item in loop?
class Program
{
    static void Main(string[] args) 
    {
        List<string> recordList = GetFromDatabase();
        Parallel.ForEach(recordList, (item) =>
        {
            item.Results = ProcessUsingExternalApi(item)
        }
    }

    static List<string> ProcessUsingExternalApi(string item)
    {
        try
        {
            using (var httpClient = new HttpClient())
            {
                // So httpClient gets instantiated for each item in calling loop
            }
        }
        catch(Exception)
        {
        }
    }
}

A:

According to Microsoft's documentation:

HttpClient is intended to be instantiated once and re-used throughout the life of an application. Instantiating an HttpClient class for every request will exhaust the number of sockets available under heavy loads. This will result in SocketException errors.

Here's how you can fix it with the example you provided:
class Program
{
    // Create a static instance
    static readonly HttpClient HttpClient;

    public Program()
    {
        // Instaniate the static instance
        HttpClient = new HttpClient();
    }

    static void Main(string[] args) 
    {
        List<string> recordList = GetFromDatabase();
        Parallel.ForEach(recordList, (item) =>
        {
            // Add HttpClient to call
            item.Results = ProcessUsingExternalApi(item, HttpClient);
        }

        // Dispose of the static instance
        HttpClient.Dispose();
    }

    // Add an HttpClient argument
    static List<string> ProcessUsingExternalApi(string item, HttpClient httpClient)
    {
        try
        {
            // use httpClient here
        }
        catch(Exception)
        {
        }
    }
}

