File tree Expand file tree Collapse file tree 6 files changed +133
-0
lines changed
Expand file tree Collapse file tree 6 files changed +133
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ namespace HelloWorld
4+ {
5+ class Hello
6+ {
7+ static void Main ( )
8+ {
9+ Console . WriteLine ( "hello\n " ) ;
10+ Console . ReadLine ( ) ;
11+ }
12+ }
13+
14+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ namespace Rectangle
3+ {
4+ class Rect
5+ {
6+ double length = 2 ;
7+ double width = 1 ;
8+ public double GetArea ( )
9+ {
10+ return length * width ;
11+ }
12+ }
13+
14+ class ExcRect
15+ {
16+ static void Main ( )
17+ {
18+ Rect r = new Rect ( ) ;
19+ Console . WriteLine ( "Area:{0}" , r . GetArea ( ) ) ;
20+ }
21+ }
22+
23+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Windows . Forms ;
3+ using MyDLL ;
4+
5+ namespace MyApplication
6+ {
7+ class App
8+ {
9+ public static void Main ( )
10+
11+ {
12+ MyDll dll = new MyDll ( ) ;
13+ dll . Text = "MyDllStr" ;
14+ Form f = new Form ( ) ;
15+ f . Text = dll . Text ;
16+ Application . Run ( f ) ;
17+
18+ }
19+ }
20+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+
3+
4+
5+ namespace MyDLL
6+ {
7+ public class MyDll
8+ {
9+ public String Text
10+ {
11+ get { return m_Text ; }
12+ set { m_Text = value ; }
13+ }
14+ private String m_Text ;
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Threading ;
3+
4+ namespace MyThrApp
5+ {
6+ class MyThread
7+ {
8+
9+ static void ThrProc ( )
10+ {
11+ string val = Thread . CurrentThread . Name ;
12+ Console . WriteLine ( "This is {0}" , val ) ;
13+ for ( int i = 0 ; i < 10 ; ++ i ) {
14+ Thread . Sleep ( 1000 ) ;
15+ Console . WriteLine ( val + " i=" + i ) ;
16+ }
17+ }
18+ static void Main ( string [ ] args )
19+ {
20+ Thread thr = new Thread ( new ThreadStart ( ThrProc ) ) ;
21+ thr . Name = "ThrProc" ;
22+ thr . Start ( ) ;
23+ Console . WriteLine ( "Main Thread Waiting...." ) ;
24+ Console . ReadKey ( ) ;
25+ }
26+ }
27+ }
Original file line number Diff line number Diff line change 1+ @ echo off
2+ set cmd_srcs = MyThread.cs
3+ set app_srcs = MyApp.cs
4+ set dll_srcs = MyDll.cs
5+
6+ for %%i in (%cmd_srcs% ) do (
7+ csc /r:System.dll %%i
8+ if not %errorlevel% == 0 (
9+ goto proc_err
10+ ) else (
11+ echo %%i succ.................................
12+ )
13+ )
14+
15+ for %%i in (%dll_srcs% ) do (
16+ csc /t:library /r:System.dll /out:MyDll.dll %%i
17+ if not %errorlevel% == 0 (
18+ goto proc_err
19+ ) else (
20+ echo %%i succ.................................
21+ )
22+ )
23+
24+ for %%i in (%app_srcs% ) do (
25+ csc /t:winexe /r:System.dll /r:System.Windows.Forms.dll /r:MyDll.dll /out:MyApp.exe %%i
26+ if not %errorlevel% == 0 (
27+ goto proc_err
28+ ) else (
29+ echo %%i succ.................................
30+ )
31+ )
32+
33+ :proc_err
You can’t perform that action at this time.
0 commit comments