Nick Heiner
Nick Heiner

Reputation: 122442

Typedef for reference types in C#?

Does C# have a typedef for reference types? I know that there's a using TypeName = RealType, but does that take effect across multiple files, or just the local scope?

Edit: If it's just in the current file, is there a way to make it global?

Upvotes: 2

Views: 561

Answers (2)

Brian Genisio
Brian Genisio

Reputation: 48137

There is no global typedef in C#. The closest you can get is subclassing. For instance, you might use it to clean up a complicated generic:

public class FunctionLookups : Dictionary<string, IEnumerable<Func<string, bool>>> {}

Upvotes: 1

user541686
user541686

Reputation: 210445

It's just in the current file.

Upvotes: 4

Related Questions