Property Template generation

3 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 11 Nov 2010 Link to this post

    What's the template syntax to get this generated properly?
    private string _property;
    public string Property{
        get{
            return _property;
        }
        set{
            _property = value;
        }
    }

    This is what I did, but it's a bit gimpy (empty line generated after the private definition) and when I get to variable 3 I get a dropdown box for some reason.

    Is there any sort of transform I can apply such that Property automatically becomes _property so I dont have to have 3 variables to enter?



    **Edit**
    Sorry, these dont get blown away if I update to another version or internal release right?
  2. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 11 Nov 2010 Link to this post

    Got it kindof, except for the underscore (if anyone needs it)

    private $1$ $2$ = $6=SELECT(null,String.Empty,Guid.Empty,Guid.NewGuid(),true,false)$;
    public $1$ $3$
    {
    get
    {
    return $2=SELECT_VARIABLE($3$)$;
    }
    set
    {
    $2$ = value;
    }
    }


    Although it still plops it out like this (space between them)
    private string _property = String.Empty;
     
    public string Property{
        get{
            return _property;
        }
        set{
            _property = value;
        }
    }

    Lets say I want an OPTIONAL V4 which will let me assign a default value to the private member...can that be done?  The only thing I see is SELECT in the documentation
  3. DevCraft banner
  4. Tsviatko Yovtchev
    Admin
    Tsviatko Yovtchev avatar
    408 posts

    Posted 15 Nov 2010 Link to this post

    Hi Steve,

     I am not quite sure I fully understand you. Let's go through this one step at a time.

    >This is what I did, but it's a bit gimpy (empty line generated after the private definition) and when I get to variable 3 I get a dropdown box for some reason.

    What is that you did? The empty line after the private definition is inserted by the JustCode formatting. We format the region of code the template produces. We can think of an exception to that rule but it's gonna be some time before we are able to have this functionality.

    >Is there any sort of transform I can apply such that Property automatically becomes _property so I dont have to have 3 variables to enter?

    Nope we don't have textual transforms as of yet. This is again something useful that we might add later.

    >**Edit** 
    Sorry, these dont get blown away if I update to another version or internal release right?

    What do you mean by that? I could not quite get it.

    >Lets say I want an OPTIONAL V4 which will let me assign a default value to the private member...can that be done?  The only thing I see is SELECT in the documentation

    You are already assigning default value to the private member using the SELECT function. What do you mean by OPTIONAL V4?


    Sincerely yours,
    Tsviatko Yovtchev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top