Thursday, June 30, 2011

C# Shortcuts (Alias ​​long namespaces and types)


The names of the identifiers of C # can be very long. For example if you are automating Microsoft Office in C #, you may want to do something as simple as MS Word to open and edit a document. You can use the "use" to create an alias for a class or namespace.


using ShortWord = Microsoft.Office.Interop.Word;
Now in code simply use ShortWord where ever you want...
ShortWord.Application = new ShortWord.Application() { Visible = True; }


No comments:

Post a Comment