Aliasing Types and Namespaces - CSharp Custom Type

CSharp examples for Custom Type:namespace

Introduction

Rather than importing the whole namespace, you can import just the specific types you need, giving each type an alias.

For example:

using PropertyInfo2 = System.Reflection.PropertyInfo;
class Program { PropertyInfo2 p; }

An entire namespace can be aliased, as follows:

using R = System.Reflection;
class Program { R.PropertyInfo p; }

Related Tutorials