Skip to content

Commit

Permalink
修复一些数据读取问题
Browse files Browse the repository at this point in the history
  • Loading branch information
kamaba committed May 20, 2024
1 parent 712df0f commit 29c748b
Show file tree
Hide file tree
Showing 12 changed files with 476 additions and 254 deletions.
4 changes: 3 additions & 1 deletion SimpleLanguage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
<ItemGroup>
<Compile Remove="source\Core\新文件夹\**" />
<Compile Remove="source\IR\新文件夹\**" />
<Compile Remove="source\MakeBin\**" />
<EmbeddedResource Remove="source\Core\新文件夹\**" />
<EmbeddedResource Remove="source\IR\新文件夹\**" />
<EmbeddedResource Remove="source\MakeBin\**" />
<None Remove="source\Core\新文件夹\**" />
<None Remove="source\IR\新文件夹\**" />
<None Remove="source\MakeBin\**" />
</ItemGroup>

<ItemGroup>
Expand All @@ -37,7 +40,6 @@
<Folder Include="source\Export\ExportCSharpCode\" />
<Folder Include="source\Export\GenerateMonoIL\" />
<Folder Include="source\Export\ExportCPlusCode\" />
<Folder Include="source\MakeBin\LLVM\" />
<Folder Include="source\OtherLanguage\CSharp\Statements\" />
</ItemGroup>

Expand Down
19 changes: 18 additions & 1 deletion md/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ data Book #定义数据
author= ["Lif", "Paper", "Mango"];
buy =
[
#这种的是用来说明,匿名对象的数组
{
time="2022-12-12";
price=25;
Expand All @@ -34,7 +35,23 @@ data Book #定义数据
price=22;
sex = 1;
}
]
],
sell =
[
#这种的是用来说明 相同带类名的数组
data1(){
time = "111";
price = 20;
},
data1(){
time = "222";
price = 30;
}
],
sell2 =
{
#这种的主要是配合的匿名类
}
}
AD
{
Expand Down
61 changes: 25 additions & 36 deletions md/enum.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,64 +27,53 @@ MixColor
Green = 0.0f;
Blue = 0.0f;
}
const enum ConstColor
enum EColor
{
Red = 0xff0000;
Green = 0x00ff00;
Blue = 0x0000ff;
enum Red = 0xff0000;
enum Green = 0x00ff00;
enum Blue = 0x0000ff;

MixColor1 = MixColor(){Red=0.9f, Green = 0.1f, Blue = 0.01f };
MixColor2 = MixColor(){Red=0.4f, Green = 0.22f, Blue = 0.7f };
}
enum Option<T>
{
T Some;
None;
F090101 = MixColor(){Red=0.9f, Green = 0.1f, Blue = 0.01f };
F040207 = MixColor(){Red=0.4f, Green = 0.22f, Blue = 0.7f };
}

ProjectEnter
{
static Main()
{
for b3 in GameState
for b3 in EColor
{
int index = b3.index;
string name = b3.name;
string value = b3.ToString();
Console.Write("Book3: " + b3 );
}

Book3 b3 = Book3.A1;
Book3 b3_3 = Book3.A1( 20 );

book = Book.B1({ i2 = 20, url = "mas" });
switch book
}
cc = EColor.Red
switch cc
{
case Book.B1 b1
case EColor.Red
{
Console.Write( "red" );
}
case EColor.Green
{
Console.Write( "bi2:" + b1.i2 );
Console.Write("green")
}
default{
Console.write("default")
}
}

Book eb = Book.B();
if eb == Book.B
if cc == EColor.Blue
{
Console.Write( eb.ToString() );
Console.Write( cc.ToString() );
}
Option op = Option.Some<String>("hello");
switch op{
case Option.Some sot:
{
Console.Write("something=" + sot.ToString() );
}
}
}
}
```
### 枚举的使用方式
- 通过enum字段字义该类为数据类型,并且,使用 {}, name = "val"等方式进行赋值,一般{}指的是匿名类
- 可以在enum前边使用const关键字,进行锁定,不允许修改内容
- enum使用方式,例: enum E1{ value1 = 1; value2 = 2; value3 = {a = 10} E1 e1 = E1.value1;的方式直接使用。
- enum 如果不使用const 可以对其的值进行修改, 例 E1 e1 = E1.value1( 20 ); 如果const,则语句报错.
- enum 中支持动态类型,使用{}表示,内容必须有值,不能为空,否则报错,赋值与普通自带类型相同, E1 e1 = E1.value3( {a=20} );的方法赋值。
- 使用T模版类型,与普通传值一样,但在switch中,有带类型判断。
- enum使用方式,例: enum E1{ value1 = 1; value2 = 2; value3 = {a = 10}} E1 e1 = E1.value1;的方式直接使用。
- for可以对enum直接进行遍历,遍历是enum的定义名称。
- switch 可以对enum的定义名称,甚至是定义名称下的值进行匹配。
- 在enum定义名称中,自带一个index字段,表明其位置,可以在 e1.index的方法查看其值,与定义的value值是不相同的,当然也可以值index来做序列号等作用。
Loading

0 comments on commit 29c748b

Please sign in to comment.