Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

"using" directive

Discussion in 'Programming Questions and Suggestions' started by Burillo, Mar 27, 2015.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Burillo Junior Engineer

    Messages:
    648
    does "using" directive work in K#? specifically, does it work for typedef-like type aliasing? e.g.
    Code:
    using StringDictionary = System.Collections.Generic.Dictionary< string, string >;
    
    or something like that.
     
  2. Malware Master Engineer

    Messages:
    9,861
    No, because you are writing inside a class. Using directives must be outside of class definitions.

    However you already have access to the Dictionary without needing to specify the namespace.

    ....

    Although, come to think of it, you may be able to use the dev-accepted workaround of closing off the class yourself, add your usings and custom classes after that.

    In theory at least. I'm not in a position to try it right now.
     
    Last edited by a moderator: Mar 27, 2015
  3. Burillo Junior Engineer

    Messages:
    648
    the purpose of it is not to "get access" but to shorten definitions for e.g. nested collections.

    I'll try the escaping trick though, thanks!

    EDIT: nope, doesn't work. even with escape trick.
     
    Last edited by a moderator: Mar 30, 2015
Thread Status:
This last post in this thread was made more than 31 days old.