本文实例为大家分享了Android九宫格图片展示的具体代码,供大家参考,具体内容如下
using System;
using Microsoft.CSharp;
using System.CodeDom.Compiler;
class Program
{
public static void Main()
{
// The C# code to execute
string code = "using System; " +
"using System.IO; " +
"public class MyClass{ " +
" public static void PrintConsole(string message){ " +
" Console.WriteLine(message); " +
" } " +
"} ";
// Compiler and CompilerParameters
CSharpCodeProvider codeProvider = new CSharpCodeProvider();
CompilerParameters compParameters = new CompilerParameters();
// Compile the code
CompilerResults res = codeProvider.CompileAssemblyFromSource(compParameters, code);
// Create a new instance of the class 'MyClass' // 有命名空间的,需要命名空间.类名
object myClass = res.CompiledAssembly.CreateInstance("MyClass");
// Call the method 'PrintConsole' with the parameter 'Hello World'
// "Hello World" will be written in console
myClass.GetType().GetMethod("PrintConsole").Invoke(myClass, new object[] {"Hello World" });
Console.Read();
}
}
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持html5模板网。
C#如何将Access中以时间段条件查询的数据添加到这篇文章主要介绍了C# 将Access中以时间段条件查询的数据添加到ListView中,需要的朋友可以参考下
使用C#创建Windows服务的实例代码这篇文章主要介绍了使用C#创建Windows服务的实例代码,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一
C#身份证识别相关技术功能详解这篇文章主要介绍了C#身份证识别相关技术详解,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
C#中TCP粘包问题的解决方法这篇文章主要为大家详细介绍了C#中TCP粘包问题的解决方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
C#实现的海盗分金算法实例这篇文章主要介绍了C#实现的海盗分金算法,结合具体实例形式分析了海盗分金算法的原理与C#相应实现技巧,需要的朋
C#操作INI配置文件示例详解这篇文章主要为大家详细介绍了C#操作INI配置文件示例,具有一定的参考价值,感兴趣的小伙伴们可以参考一下