gpt4 book ai didi

c# - 获取 CodeDomProvider 实例的正确方法

转载 作者:太空狗 更新时间:2023-10-30 01:26:06 25 4
gpt4 key购买 nike

var codeProvider = new CSharpCodeProvider();

or

var codeProvider = new CodeDomProvider.CreateProvider("C#");

他们似乎在做同样的事情,这让我很困惑!

最佳答案

var codeProvider = new CSharpCodeProvider(); 其中 CSharp 是运行时之前的已知语言。

请参阅下面关于 CodeDomProvider.CreateProvider 的注释方法引用:

This method is most commonly used to create an instance of a code provider in an application that may optionally use one of several providers. CreateProvider allows you to specify at run time the code provider you wish to instantiate. If you know at design time which code provider is to be used, you should create an instance of that code provider rather than use the CreateProvider method.

关于c# - 获取 CodeDomProvider 实例的正确方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5672232/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com