C# FAQ: Is typedef available in CSharp
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| CSharp-Online.NET:FAQs |
| edit |
[edit]
Is typedef available in C# ?
No. C# contains no direct equivalent of the C++ typedef keyword. However, C# does feature an alias specified with the using keyword as in the following example:
using ByteList = System.Collections.Generic.List<byte>;
The scope of the alias is limited to the file in which it is declared. Some applications can use inheritance to get around this limitation as in the following example:
public class ByteList : List<byte> {}