static imports in c#
问题 Does C# has feature like Java's static imports? so instead of writing code like FileHelper.ExtractSimpleFileName(file) I could write ExtractSimpleFileName(file) and compiler would know that I mean method from FileHelper. 回答1: Starting with C# 6.0, this is possible: using static FileHelper; // in a member ExtractSimpleFileName(file) However, previous versions of C# do not have static imports. You can get close with an alias for the type. using FH = namespace.FileHelper; // in a member FH