Author Topic: passing a table and transforming it to code  (Read 1713 times)

flethuseo

  • Senior Community Member
  • Posts: 177
  • Hero Points: 2
passing a table and transforming it to code
« on: July 03, 2013, 02:59:50 pm »
Hi everyone,

I have to do this for a number of properties, and wondering if I can automate such that I give a tab sepparated table like this:
    type   propname   objname
    type   propname   objname
    type   propname   objname
    type   propname   objname
    type   propname   objname

and each row is transfomed to an accessor like the code shown below.  I was thinking of using several expand_alias command in a macro for this, but there does not seem to be a way to silently pass the parameters to the expand-alias command. 

    /// <summary>
    ///     Accessor for the %(propname) property in the %(objname) object.
    /// </summary>
    public %(type) %(propname)
    {
        get { return %(objname).%(propname); }
        set { %(objname).%(propname) = value; }
    }

Anyone have a macro that does something like this?

Any help appreciated,
Ted

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: passing a table and transforming it to code
« Reply #1 on: July 03, 2013, 11:00:24 pm »
See this thread how to do similar things. Here and here are some more examples for custom alias helper macros.
Good luck, HS2