How to rename a “using Directive” C#

How would you rename a "Using Directive" Using C#?

Because some times You copy a class from somewhere (Example below)

//Other Code
        Excel.ApplicationClass excel;
        Excel.Workbooks workbooks;
        Excel.Workbook workbook;
        Excel.Worksheet worksheet;
        Excel.Sheets worksheets;
//Other Code

and instead of renaming everything to

//Other Code
        Microsoft.Office.Interop.Excel.ApplicationClass excel;
        Microsoft.Office.Interop.Excel.Workbooks workbooks;
        Microsoft.Office.Interop.Excel.Workbook workbook;
        Microsoft.Office.Interop.Excel.Worksheet worksheet;
        Microsoft.Office.Interop.Excel.Sheets worksheets;
//Other Code

So having something like

Using  Microsoft.Office.Interop.Excel.ApplicationClass as 'Excel'

Answers


You can create an alias like this:

// for whole namespace
using Excel = Microsoft.Office.Interop.Excel;
// use like this
Excel.ApplicationClass excel = /* ... */;

// or for single type
using ExcelApp = Microsoft.Office.Interop.Excel.ApplicationClass;
// use like this
ExcelApp excel = /* ... */;

Need Your Help

How to manipulate nodes added by Google-Tasks?

javascript google-chrome google-chrome-extension content-script google-tasks

I'm currently trying to change style elements for this Google-tasks gadget: