本文整理汇总了C#中Microsoft.VisualBasic.VBCodeProvider.GenerateCodeFromMember方法的典型用法代码示例。如果您正苦于以下问题:C# VBCodeProvider.GenerateCodeFromMember方法的具体用法?C# VBCodeProvider.GenerateCodeFromMember怎么用?C# VBCodeProvider.GenerateCodeFromMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.VisualBasic.VBCodeProvider
的用法示例。
在下文中一共展示了VBCodeProvider.GenerateCodeFromMember方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deny_Unrestricted
public void Deny_Unrestricted ()
{
VBCodeProvider vbprov = new VBCodeProvider ();
Assert.AreEqual ("vb", vbprov.FileExtension, "FileExtension");
Assert.AreEqual (LanguageOptions.CaseInsensitive, vbprov.LanguageOptions, "LanguageOptions");
Assert.IsNotNull (vbprov.CreateCompiler (), "CreateCompiler");
Assert.IsNotNull (vbprov.CreateGenerator (), "CreateGenerator");
try {
Assert.IsNotNull (vbprov.GetConverter (typeof (string)), "GetConverter");
}
catch (NotImplementedException) {
// mono
}
#if NET_2_0
CodeTypeMember ctm = new CodeTypeMember ();
StringWriter sw = new StringWriter ();
CodeGeneratorOptions cgo = new CodeGeneratorOptions ();
try {
vbprov.GenerateCodeFromMember (ctm, sw, cgo);
}
catch (NotImplementedException) {
// mono
}
#endif
}
示例2: GenerateVBTo
/// <summary>
/// Generates VB text from a type member and writes it to a text writer with the given options.
/// </summary>
/// <param name="typeMember">The type member to generate text from.</param>
/// <param name="writer">The text writer to write to.</param>
/// <param name="options">The generation options.</param>
public static void GenerateVBTo(this CodeTypeMember typeMember, TextWriter writer, CodeGeneratorOptions options)
{
using (var provider = new VBCodeProvider())
{
provider.GenerateCodeFromMember(typeMember, writer, options);
}
}