Tests: Add new test assemblies for C# features (#36)
* Add new test assemblies for C# features Three of these test assemblies go over several important features of C#, organized by C# language version. PartialGenericTypes stresses closed and partially closed generics. Finally, VTablesAndLayout tests the layout of classes when translated to C++, and also contains code which calls vtable and interface functions to test reverse engineering. * Tests: Update .csproj * Tests: Update .csproj Co-authored-by: Katy Coe <djkaty@users.noreply.github.com>
This commit is contained in:
25
Il2CppTests/TestSources/CSharp3.cs
Normal file
25
Il2CppTests/TestSources/CSharp3.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
/* C# 3.0 feature test */
|
||||
namespace Il2CppTests.TestSources
|
||||
{
|
||||
public class FeatureTest
|
||||
{
|
||||
public string AutoProp { get; set; }
|
||||
public void AnonType() {
|
||||
var c = new { Value = 3, Message = "Nobody" };
|
||||
Console.WriteLine(c);
|
||||
}
|
||||
|
||||
public int Linq() {
|
||||
var scores = new int[] { 1, 2, 3, 4 };
|
||||
var highScoresQuery =
|
||||
from score in scores
|
||||
where score > 80
|
||||
orderby score descending
|
||||
select score;
|
||||
return highScoresQuery.Count();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user