You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 5, 2023. It is now read-only.
yueyinqiu edited this page Nov 29, 2021
·
3 revisions
You can find all the codes in the project UseCases.
used namespaces
usingSystem;usingYiJingFramework.FiveElements;
to get or convert elements
FiveElementwood=FiveElement.Wood;_=FiveElement.TryParse(" metal \t\n",outFiveElementmetal);_=FiveElement.TryParse(" 木 \t\n",out_);// case-insensitive and allows white spaces preceding and trailing.FiveElementfire=(FiveElement)6;// we don't suggest this, unless you are (de)serializing something.// ...// -2: 金 Metal// -1: 水 Water// 0: 木 Wood *// 1: 火 Fire *// 2: 土 Earth *// 3: 金 Metal *// 4: 水 Water *// 5: 木 Wood// 6: 火 Fire// ...Console.WriteLine($"{fire.ToString()}{(int)fire} OVERCOMES {metal}{(int)metal}!");Console.WriteLine($"{fire.ToString("C")}克{metal:C}");Console.WriteLine();// Output: Fire 1 OVERCOMES Metal 3!// 火克金
to use the relationship between elements
FiveElementwater=wood.GetElement(FiveElementsRelationship.GeneratingMe);// water generates wood.Console.WriteLine($"fire to {water}: {water.GetRelationship(fire)}");// water overcomes fire// Output: fire to Water: OvercameByMe