C#中實現字符串表達式計算

com引用   MSScriptControl

 MSScriptControl.ScriptControlClass msc=new MSScriptControl.ScriptControlClass();
    msc.Language="vbs";
    msc.ExecuteStatement("dim a");
    msc.ExecuteStatement("If True Then a=1 End If ");
    object i=msc.Eval("a");
    int b=int.Parse(i.ToString()); 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章