Test: ironpython script execution function

Source: Internet
Author: User
This ironpython (iron python?) has been found yesterday and today ?), I have heard of this thing for a long time, but it is really limited in energy, so I have never learned it. Recently, because we need to consider our application Program Add the script function, so I started a simple trial.
Syntax? There is nothing to say about it. The online documents are full of documents, and they also come with excellent tutorials.
My favorite features are:
-Good interoperability with. NET and COM;
-Static DLL files can be generated, and the created files contain PDB. Therefore, you can perform breakpoints, check variables, and make them dizzy and powerful;
-Using. Net can easily use its engine, and a lot of information on the Internet is old, so I wrote one myself. The following example shows how to create Code It interacts with your own program. Using System;
Using Ironpython. Hosting;

Namespace Leleapplication1 {
Class Program {
Static   Void Main ( String [] ARGs) {
A =   New A ();
String Code =   @" A. Amount = 3 " ;

Pythonengine Engine =   New Pythonengine ();
Enginemodule dbafmodule = Engine. createmodule ( " Dbaf " , True );
Dbafmodule. globals. Add ( " A " , );
Engine. Execute (Code, dbafmodule );

Console. writeline (A. amount );
Console. Readline ();
}
}

Public   Class A {

Private   Int _ Amount;

Public   Int Amount {
Get   {Return_ Amount ;}
Set   {_ Amount=Value ;}
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.