public void WithNotEmpty() { var source = new Dictionary<int, string> { { 1, "a" }, { 2, "b" }, { 3, "c" } }; var result = source.With(2); Assert.AreEqual("b", result); }
public void WithEmpty() { Dictionary <int, string> source = null; var result = source.With(2); Assert.AreEqual(null, result); }
public void WithNotEmpty() { var source = new Dictionary <int, string> { { 1, "a" }, { 2, "b" }, { 3, "c" } }; var result = source.With(2); Assert.AreEqual("b", result); }
static void Main(string[] args) { MonadsForObjects.DoDemo(); var data = new Dictionary<int, string>(); //data.Add(1, "My Name"); //data.With(1).Do(_ => Console.WriteLine($"已找到Key为1的结果:{_}")); data.With(1).Return(_ => $"已找到Key为1的结果:{_}", "未找到Key为1的结果").Do(_ => Console.WriteLine(_)); data.Return(1, _ => { Console.WriteLine("Key1不存在,添加Key1"); _. }) //data.TryWith(1) Console.Read(); }
static void Main(string[] args) { MonadsForObjects.DoDemo(); var data = new Dictionary <int, string>(); //data.Add(1, "My Name"); //data.With(1).Do(_ => Console.WriteLine($"已找到Key为1的结果:{_}")); data.With(1).Return(_ => $"已找到Key为1的结果:{_}", "未找到Key为1的结果").Do(_ => Console.WriteLine(_)); data.Return(1, _ => { Console.WriteLine("Key1不存在,添加Key1"); _. }) //data.TryWith(1) Console.Read(); }
public Item GetArmSlotItem(ArmSlotType armSlotType) { return(armSlotsInfo.With(armSlotType)); }
public Item GetBodySlotItem(BodySlotType bodySlotType) { return(bodySlotsInfo.With(bodySlotType)); }
public void FixOffset(long offset) { Offset = offset; Dictionary = Dictionary.With(NameToken.Prev, new NumericToken(offset)); }
public T GetArmSlotItem <T>(ArmSlotType armSlotType) where T : Item { return(armSlotsInfo.With(armSlotType) as T); }
public MethodDocumentation ForMethod(MethodInfo methodInfo) { return(methodDocs.With(methodInfo.GetDocStyleSignature())); }