mirror of
https://github.com/milimoe/FunGame-Testing.git
synced 2025-04-23 12:49:34 +08:00
添加项目文件。
This commit is contained in:
parent
5f948ef9cc
commit
e3ffc42afe
16
FunGame.Testing.csproj
Normal file
16
FunGame.Testing.csproj
Normal file
@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="FunGame.Core">
|
||||
<HintPath>..\FunGame.Core\bin\Debug\net7.0\FunGame.Core.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
25
FunGame.Testing.sln
Normal file
25
FunGame.Testing.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.33516.290
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FunGame.Testing", "FunGame.Testing.csproj", "{6F6B4A21-8F39-4B0D-84E8-98AE3E93F06F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6F6B4A21-8F39-4B0D-84E8-98AE3E93F06F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6F6B4A21-8F39-4B0D-84E8-98AE3E93F06F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6F6B4A21-8F39-4B0D-84E8-98AE3E93F06F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6F6B4A21-8F39-4B0D-84E8-98AE3E93F06F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {BC95D91C-1F6B-4E3A-9DC6-49EDFB018CDE}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
6
Main.cs
Normal file
6
Main.cs
Normal file
@ -0,0 +1,6 @@
|
||||
using System.Data;
|
||||
using Milimoe.FunGame.Testing.Solutions;
|
||||
|
||||
DataTable dt = DataTableSolution.GetDataTable();
|
||||
|
||||
Console.WriteLine(dt.Rows[0]["Name"]);
|
27
Solutions/DataTable.cs
Normal file
27
Solutions/DataTable.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.Data;
|
||||
using System.Text.Json;
|
||||
using Milimoe.FunGame.Core.Model;
|
||||
|
||||
namespace Milimoe.FunGame.Testing.Solutions
|
||||
{
|
||||
public class DataTableSolution
|
||||
{
|
||||
public static DataTable GetDataTable()
|
||||
{
|
||||
DataTable dt = new();
|
||||
dt.Columns.Add(new DataColumn("ID", typeof(int)));
|
||||
dt.Columns.Add(new DataColumn("Name", typeof(string)));
|
||||
DataRow dr = dt.NewRow();
|
||||
dr["ID"] = 1;
|
||||
dr["Name"] = "Mili";
|
||||
dt.Rows.Add(dr);
|
||||
|
||||
JsonObject2 jsonobj = new();
|
||||
|
||||
string json = JsonSerializer.Serialize(dt, jsonobj.Options);
|
||||
DataTable? dt2 = JsonSerializer.Deserialize<DataTable>(json, jsonobj.Options);
|
||||
|
||||
return dt2 ?? new();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user