开发者

Is there any way to have functions in basic T4 templates?

By basic T4 template, I mean not using T4 Toolkit or any of the add-ins.

My T4 is getting a little complicated, but I'd like to keep in self-contained for now. Is there a way have functions in your T4 template, wi开发者_如何学Gothout referencing external assemblies?


You mean like this:

<#+
    public List<string> Dostuff()
    {
        List<string> result = new List<string>(); 

        // ...

        return result;
    }
#>

Here's a complete example: Reading a Xml File in T4 Templates

Oleg Sych's T4Toolbox is a good resource.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜