返り値のない関数の呼び出し
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
-
|
|
|
|
|
|
|
|
|
|
|
!
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!
|
.assembly x {}
.method static void main()
{
.entrypoint
ldstr "numb" ldstr "angel" ldstr "boy" call void func1(string, string, string)
ret
}
.method static void func1( string msg1, string msg2, string msg3)
{
ldarg msg1 call void class [mscorlib]System.Console::WriteLine(string)
ldarg msg2 call void class [mscorlib]System.Console::WriteLine(string)
ldarg msg1 call void class [mscorlib]System.Console::WriteLine(string)
ldarg msg3 call void class [mscorlib]System.Console::WriteLine(string)
ret
}
|
実行結果:
numb
angel
numb
boy
C#では・・・
1
2
3
4
5
6
7
8
9
10
11
12
|
-
|
!
-
|
|
|
|
!
|
void main()
{
func1("numb","angel","boy");
}
void func1( string msg1, string msg2, string msg3 )
{
System.Console.WriteLine( msg1 );
System.Console.WriteLine( msg2 );
System.Console.WriteLine( msg1 );
System.Console.WriteLine( msg3 );
}
|
VB.NETでは・・・
1
2
3
4
5
6
7
8
9
|
public sub main()
func1("numb","angel","boy")
end sub
public sub func1( msg1 as string, msg2 as string, msg3 as string )
System.Console.WriteLine( msg1 )
System.Console.WriteLine( msg2 )
System.Console.WriteLine( msg1 )
System.Console.WriteLine( msg3 )
end sub
|
返り値のある関数の呼び出し
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
-
|
|
|
|
|
|
|
|
|
!
-
|
|
!
|
.assembly x {}
.method static void main()
{
.entrypoint
ldstr "in the door way" call string func1( string ) call void class [mscorlib]System.Console::WriteLine(string)
ret
}
.method static void func1( string msg1 )
{
ldarg msg1 ret
}
|
実行結果:
in the door way
C#では・・・
1
2
3
4
5
6
7
8
9
|
-
|
!
-
|
!
|
void main()
{
System.Console.WriteLine( func1( "in the door way" ) );
}
void func1( string msg1 )
{
return msg1;
}
|
VB.NETでは・・・
1
2
3
4
5
6
7
|
public sub main()
System.Console.WriteLine( func1( "in the door way" ) )
end sub
public sub func1( msg1 as string )
func1 = msg1
end sub
|
参照 †
|
Last-modified: Mon, 27 Jul 2009 03:06:22 JST