Declaring a type synonym in C# -


i hope missed in docs. there way declare type synonym in c#?

you can use using statement create alias type.

for example, following create alias system.int32 called myint

using myint = system.int32; 

alternatively, can use inheritance in cases. example

create type people list<person>

public class people: list<person> { } 

not quite alias, simplify things, more complex types this

public class somestructure : list<dictionary<string, list<person>>> { } 

and can use type somestructure rather fun generic declaration.

for example have in comments, tuple following.

public class mytuple : tuple<int, string> {   public mytuple(int i, string s) :     base(i, s)   {   } } 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -