There are two ways to remove unused using from our code . Remove Unused Usings option in Visual Studio removes unused using (namespace) in our code .
The first way is :
1) Main Menu - On the Edit menu, point to IntelliSense, point to Organize Usings, and then click Remove Unused Usings.
(click on image for clear view)
2) Context Menu - Right-click anywhere inside the code editor, point to Organize Usings, and then click Remove Unused Usings.
The following example shows the outcome of performing Remove Unused Usings on source code.
Before:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
After:
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
The first way is :
1) Main Menu - On the Edit menu, point to IntelliSense, point to Organize Usings, and then click Remove Unused Usings.
(click on image for clear view)
2) Context Menu - Right-click anywhere inside the code editor, point to Organize Usings, and then click Remove Unused Usings.
The following example shows the outcome of performing Remove Unused Usings on source code.
Before:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
After:
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
No comments:
Post a Comment
Thanks for your comments.
-Sameer