zoukankan      html  css  js  c++  java
  • MaxScript中使用动态编译的C#

    MaxScript中使用动态编译的C#
    CSharpCodeSource ="using System;
    using System.Windows.Forms;
    namespace TestNameSpace
    {
    public class TestClass
    {
    public void Test(string theString)
    {
    MessageBox.Show(theString);
    }
    }
    }
    "
    CSharpProvider
    = dotnetobject "Microsoft.CSharp.CSharpCodeProvider"
    CompilerParams
    = dotnetobject "System.CodeDom.Compiler.CompilerParameters"

    CompilerParams.ReferencedAssemblies.Add(
    "System.dll")
    CompilerParams.ReferencedAssemblies.Add(
    "System.Windows.Forms.dll")
    CompilerParams.GenerateExecutable
    = false
    CompilerParams.GenerateInMemory
    = false

    CompilerResults
    = CSharpProvider.CompileAssemblyFromSource CompilerParams #(CSharpCodeSource)

    WinAssembly
    = CompilerResults.CompiledAssembly
    TestAssembly
    = WinAssembly.CreateInstance "TestNameSpace.TestClass"
    TestAssembly.Test
    "动态编译的C#"

    (DotNetObject
    "TestNameSpace.TestClass").Test "动态编译的C#"
  • 相关阅读:
    C语言指向指针的指针
    C语言注意事项
    C语言指针
    C语言字符串
    C语言数组
    C语言交换两个数的值
    C语言位运算符
    C语言各种进制输出
    C语言中各种进制的表示
    C 语言sizeof运算符
  • 原文地址:https://www.cnblogs.com/sitt/p/1772003.html
Copyright © 2011-2022 走看看