Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit25f9e99

Browse files
committed
revert HelloWorld sample code changes
1 parent2ff358b commit25f9e99

File tree

1 file changed

+9
-103
lines changed

1 file changed

+9
-103
lines changed

‎src/mono/sample/HelloWorld/Program.cs‎

Lines changed: 9 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -2,112 +2,18 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
usingSystem;
5-
usingSystem.Runtime.CompilerServices;
65

7-
#iffalse
8-
9-
publicclassMyBox<T>
10-
{
11-
privateT_value;
12-
publicTValue{get=>_value;privateset{_value=value;}}
13-
publicMyBox(Tinp){Value=inp;}
14-
}
15-
16-
publicclassSimpleBox
6+
namespaceHelloWorld
177
{
18-
privatedecimal_value;
19-
publicdecimalValue{get=>_value;privateset{_value=value;}}
20-
publicSimpleBox(decimalinp){Value=inp;}
21-
}
22-
23-
publicclassProgram
24-
{
25-
publicstaticvoidMain()
8+
internalclassProgram
269
{
27-
varsbox=newSimpleBox((decimal)-5);
28-
RunSimple(sbox,(decimal)20);
29-
Console.WriteLine("20 = {0}",sbox.Value);
30-
varbox=newMyBox<string>("xyz");
31-
RunItAgain<string>(box,"hjk");
32-
Console.WriteLine("hjk = {0}",box.Value);
33-
varbox2=newMyBox<decimal>((decimal)-2);
34-
RunItAgain<decimal>(box2,(decimal)10.0);
35-
Console.WriteLine(box2.Value);
36-
RunIt<string>(box,"abc");
37-
Console.WriteLine("abc = {0}",box.Value);
38-
}
39-
40-
[MethodImpl(MethodImplOptions.NoInlining)]
41-
publicstaticvoidRunIt<H>(MyBox<H>dest,Hinput)
42-
{
43-
refHboxWriter=refAccessBox(dest);
44-
boxWriter=input;
45-
}
46-
47-
[MethodImpl(MethodImplOptions.NoInlining)]
48-
publicstaticvoidRunItAgain<S>(MyBox<S>dest,Sinput)
49-
{
50-
refSboxWriter=refAccessHelper<S>.AccessBox2(dest);
51-
boxWriter=input;
52-
}
53-
54-
[UnsafeAccessor(UnsafeAccessorKind.Field,Name="_value")]
55-
privatestaticexternrefWAccessBox<W>(MyBox<W>x);
56-
57-
[MethodImpl(MethodImplOptions.NoInlining)]
58-
privatestaticvoidRunSimple(SimpleBoxs,decimalinput)
59-
{
60-
refdecimalboxWriter=refSimpleHelper.AccessSimpleBox(s);
61-
boxWriter=input;
62-
}
63-
}
64-
65-
publicclassAccessHelper<Q>
66-
{
67-
#iffalse
68-
[MethodImpl(MethodImplOptions.NoInlining)]
69-
publicstatic/*extern*/refQAccessBox2(MyBox<Q>q)=>thrownewNotImplementedException("exn");
70-
#else
71-
[UnsafeAccessor(UnsafeAccessorKind.Field,Name="_value")]
72-
publicstaticexternrefQAccessBox2(MyBox<Q>q);
73-
#endif
74-
}
75-
76-
publicclassSimpleHelper
77-
{
78-
[UnsafeAccessor(UnsafeAccessorKind.Field,Name="_value")]
79-
publicstaticexternrefdecimalAccessSimpleBox(SimpleBoxb);
80-
}
81-
82-
#else
83-
84-
publicclassMyService<T>
85-
{
86-
publicMyService(){}
87-
88-
privatestaticstringExplain(Targ)=>arg.ToString()+" : "+typeof(T).ToString();//$"{arg} : {typeof(T)}";
89-
}
90-
91-
publicclassProgram
92-
{
93-
publicstaticvoidMain()
10+
privatestaticvoidMain(string[]args)
9411
{
95-
newProgram().Runner<string>("abcd");
12+
boolisMono=typeof(object).Assembly.GetType("Mono.RuntimeStructs")!=null;
13+
Console.WriteLine($"Hello World{(isMono?"from Mono!":"from CoreCLR!")}");
14+
Console.WriteLine(typeof(object).Assembly.FullName);
15+
Console.WriteLine(System.Reflection.Assembly.GetEntryAssembly());
16+
Console.WriteLine(System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription);
9617
}
97-
98-
[MethodImpl(MethodImplOptions.NoInlining)]
99-
publicvoidRunner<Q>(Qx)
100-
{
101-
Console.WriteLine(AccessHelper<Q>.CallExplain(default,x));
102-
}
103-
104-
}
105-
106-
publicstaticclassAccessHelper<W>
107-
{
108-
[UnsafeAccessor(UnsafeAccessorKind.StaticMethod,Name="Explain")]
109-
publicstaticexternstringCallExplain(MyService<W>target,Warg);
110-
18+
}
11119
}
112-
113-
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp