IronPython v.1, .NET v.2 vs. C# Last updated on , a full moon day
IFF code (snippets) also see: keyword;
>>> from System.Collections import *
>>> = Hashtable ( )
>>> [ "abc" ] = "Your_defined_initialized_name1"
>>> [ "xyz" ] = "Your_defined_initialised_name2"
i.e. >>> [ "abc" ]
'abc'
i.e. >>> [ "xyz" ]
'xyz'
>>>
abc , Your_defined_initialized_name1
xyz , Your_defined_initialised_name2
...
Therefore, in Python vs. C# | |
Python | C# |
x, y =
,
x, y = y, x
|
void function_name(ref
int x, ref int y) { int temporary_variable = x; x = y; y = temporary_variable; } int x = , y = ; function_name(ref x, ref y); |
A function with 2 parameters to get values; Notice that parameter gets dir/file number, parameter gets M strings | |
def function_to_get_values ( ) : return , " " x_dimension, m_string = function_to_get_values ( ) |
object [ ] function_to_get_values ( ) { object [ ] return_result_of_THIS_{ } = new object [ ]; object [ ] = ; object [ ] = " "; return return_result_of_THIS_{ }; } object [ ] return_result_of_THIS_{ } = function_to_get_values ( ); int x_dimension = (int data_type_cast_to_integer) return_result_of_THIS_{ } [ ]; string m_string = (string data_type_cast_to_characters) return_result_of_THIS_{ } [ ]; |
IFF IronPython v.1, .NET v.2 vs. XML
>>> import clr clr module
>>> clr.AddReference ( " System.Xml " )
>>> from System.Xml import *
>>> d_for_document = XmlDocument ( )
IFF concatenated string
>>> m_string = "Burmese Python"
>>> m_string.Trim ( )
Traceback , line number , in <stdin>########8
>>> import clr
>>> m_string.Trim ( )
'Python'
...
IFF fancy graphics labeling
>>> import winforms
>>> from System.Windows.Forms import *
>>> from System.Drawing import *
>>> from ...
...
>>> instant_form = Form ( )
>>> instant_form.Show ( )
>>> instant_form.Text = "Window's title phrase here"
...
>>> def click ( Left_dir/file_form , Right_data ): WHEN a mouse click, window
will prompt texts
>>> text_object = Label ( Text = ""
)
>>> text_object.Location = Right_data.Location
>>> Left_dir/file_form.Controls.Add ( text_object )
>>> Left_dir/file_form.Click += click
>>> for i_integer_counter in Left_dir/file_form.Controls: i_integer_counter.Font
= Font ( "System", 15 )
>>> for i_integer_counter in Left_dir/file_form.Controls: i_integer_counter.Text
= ""
>>> Left_dir/file_form.Controls.Clear ( )
...
>>> import clr
>>> clr.AddReferenceToFile ( "
Previously_built_dynamic_link_library.dll " )
>>> import Simple_class
>>> dir ( Simple_class )
[ 'Equals' , 'GetHashCode' , 'GetType' , 'ToString' , '__new__' , '__repr__' ...
]
...
>>> string_to_print = Simple_class (10)
>>> print string_to_print
Simple_class<10>
IFF building dynamic link library file *.dll; Languages: C#, JAVA, VB, ...
using System;
using System.Collections;
public class Simple_class {
private int data_for_Right_pane;
public Simple_class (int data_for_Right_pane ) {
this.data_for_Right_pane = data_for_Right_pane;
}
public override string ToString ( ) {
return String.Format ("Simple_class<{ 0 } >" , data_for_Right_pane );
}
} At this stage dll named Simple_class.cs as file in %PATH% and Mutual exclusion must have {TRUE}
For further reading: codeplex.com; python.org;