从IntelliSense支持文件动态生成一个枚举 [英] Generate an enum dynamically from file with intellisense support

查看:94
本文介绍了从IntelliSense支持文件动态生成一个枚举的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说过许多关于罗斯林,而我只是想有没有可能从XML文件动态生成的代码,以便为开发这将是透明的,他能列举与智能感知代码,如果代码被写入工程

I heard lots about Roslyn, and I just thought is it possible to generate code dynamically from an xml file so that for the developer it will be transparent and he could enumerate the code with IntelliSense as if the code is written in the project.

我写一个框架,有很多通过配置文件进行定制,并且真的想使用这样的功能,如果这是可能的。

I am writing a framework with a lot of customization done via config files, and would really like to use such feature if it's possible.

推荐答案

你想要的是什么F#调用的类型供应商,它可能是可能通过黑客的罗斯林编译器做的,但我认为这将是一个大量的工作。你可能想看看相关的问题莫非F#类型供应商在C#合并。最好的办法可能是使用F#的类型提供了F#项目,然后引用该项目和它的类型从C#的项目,但我不能告诉如果这是可行的,因为我缺乏F#的经验。

What you want is what F# calls type providers and it probably is possible to do by hacking the Roslyn compiler but I think it will be a lot of work. You may want to have a look at the related question Could F# type providers be incorporated in C#. Your best bet may be to use the F# type providers in a F# project and then reference this project and its types from C# projects but I can not tell if this is viable because I am lacking F# experience.

这篇关于从IntelliSense支持文件动态生成一个枚举的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆