Use explicitly typed local variable declaration

5 posts, 0 answers
  1. Jason
    Jason avatar
    6 posts
    Member since:
    Sep 2012

    Posted 09 Oct 2013 Link to this post

    This feature is used by coders to explicitely state the type of a particular variable.   All you need to do is type var myvar = fn(); hit the hotkey, and BAM!  var changes to the actual return type of fn().

    According to the help files, this feature only works in C# (not VB).

    That sucks.

    Is there any intention to get that feature working with JustCode in VB?  The checkbox is there in options, but the feature always assumes it's an "Object" instead of it's actual type, which is almost always worse than just using the native VS type inference.  

    By comparison, DevExpress had that feature pretty early in their suite and I enjoyed it thoroughly.

    Thanks,

    Jason


  2. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 10 Oct 2013 Link to this post

    Hi Jason,

     Thanks for contacting us.
    I just tested this feature in VB with the latest JustCode internal build version and it seems that it is working fine. I will fix this misleading information in the documentation.
    Please update your JustCode and give it a try. If you find that it returns an object instead of the right type please send us a sample project or a code snippet so we could investigate.
    Thank you.

    Regards,
    Zdravko
    Telerik
    Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
  3. DevCraft banner
  4. Jason
    Jason avatar
    6 posts
    Member since:
    Sep 2012

    Posted 10 Oct 2013 Link to this post

    I'm still getting it even after upgrading to the latest version:

    Q3 2013 Internal Build (2013.3.1004.2)

    Module Module1
        Sub Main()
            'when I select "use explicitly typed local variable declaration" on the next line, it wrongfully infers that it should be an object
            Dim response = proof()
        End Sub
        Function proof() As Int32
            Return 1
        End Function
    End Module

    I'm running VS 2010 10.0.40219.1 SP1Rel if that makes a difference, though I've confirmed that the problem also exists in VS 2012 (I have both installed).

    I also verified that this DOES work with C# on my machine...  But unfortunately the project that I'm currently working on is in VB so that knowledge grants me little solace.
  5. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 11 Oct 2013 Link to this post

    Hi Jason,

     Thanks for the code snippet.
    I used it in my demo, but everything is as expected.
    I already wrote to you at your other ticket to send us a sample project if possible.
    Thank you.

    Regards,
    Zdravko
    Telerik
    Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
  6. Jason
    Jason avatar
    6 posts
    Member since:
    Sep 2012

    Posted 11 Oct 2013 Link to this post

    The problem was caused by the fact that I had Option Infer turned off.   The feature requires Option Infer to be enabled.

    Thanks for your help, Zdravko and "Telerik Admin". :-)
Back to Top
DevCraft banner