in
Forums
Blogs
Files
Devexpress.Com
Client Center
Support Center
DevExpress Channel

Need a real "Smart Return"

Last post 10/10/2007 4:09 PM by Mike Booth. 0 replies.
Page 1 of 1 (1 items)
Sort Posts:
Previous Next
  • 10/10/2007 4:09 PM

    Need a real "Smart Return"

    I now that Smart Return is used for the return value of a method.

    But I'm running into a problem because I would like to have the same thing on the return value of a instance method for my template. For example:

    List<Application> listApplication = new List<Application>();

    <<Smart Return>> = someInstance.SomeMethod(); //This method should return a List<Application>

    The result would be:

    listApplication = someInstance.SomeMethod();

    The reason I need this besides it being very helpful in general, is because in my template I'm linking the return value in the method to the return value of the instance method I call with that method. For example:

    #Method# Template
    public <<Link(ReturnValue)>> MethodName()
    {

         <<Caret>><<FieldStart>><<Link(ReturnValue)>><<FieldEnd>><<BlockAnchor>> <<Link(ReturnValue,FormatParamName)>> = new <<Link(ReturnValue)>>;

         <<Link(ReturnValue,FormatParamName)>> = SomeInstance.SomeMethod();

    What happens when I do this Visual Studio screws up all the formating. So I have a work around for this by using a <<Target>>.

    #ReturnValue# Template
    <<Link(ReturnValue,FormatParamName)>> = SomeInstance.SomeMethod();

    #Method Template#
    public <<Link(ReturnValue)>> MethodName()
    {

         <<Caret>><<FieldStart>><<Link(ReturnValue)>><<FieldEnd>><<BlockAnchor>> <<Link(ReturnValue,FormatParamName)>> = new <<Link(ReturnValue)>>;

         <<Target(#ReturnValue#)>>

    This sovles the format problem, but it creates another problem that I can get the variable name of the return type. I have tried passing the name as a Variable using <<Set>> and <<Get>> but Variables don't seem to get passed with <<Target>>. My only other option is to have a real Smart Return or create a DXCore pluging, but I don't want to because I need to distribute this to other people.

     Any other ideas?

    Thanks,
    Eric

    Filed under: ,
Page 1 of 1 (1 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED