Chetan Sanghani
Chetan Sanghani

Reputation: 2111

How to identify unused methods, codes, libraries and references in VScode

Team,

I need to identify & remove unused variables (arguments, local variables, class member variables), Libraries, and references that are unused in VS code.

I have also tried to find out some extensions or plugins or Nuget packages but no luck and also researched a lot but didn't find relevant links which can fulfill my need. I know someone from this community who can help me with this.

Please check below code sample for unused code and I want something to identify that are unused and want to remove those.

using System;
using System.Diagnostics; //unused
using Microsoft.AspNetCore.Mvc; //unused
using Microsoft.AspNetCore.Mvc.RazorPages; //unused

public class HelloWorld
{
    public string? RequestId { get; set; } //unused 
    private readonly ILogger<ErrorModel> _logger; //unused
    public static void Main(string[] args)
    {
        Console.WriteLine ("Hello Mono World");
    }
    public ErrorModel(ILogger<ErrorModel> logger) // This method is unused
    {
       //Some code here
    }

}

Upvotes: 0

Views: 1180

Answers (0)

Related Questions