devxlogo

Using Aliases for Namespaces in C#

Using Aliases for Namespaces in C#

We can use an alias for long namespaces and use it further down in the code. For an example, see below:

//InteropExcel is the aliasusing InteropExcel = Microsoft.Office.Interop.Excel;public class SpreadSheetInteropHelper{  public void InitializeApplication()  {  var excelApplication = new InteropExcel.Application();   }}

devx-admin

Share the Post: