public void Do(IDo o, Doer doer) { if (o is A a) { doer.Do(a); } else if (o is B b) { doer.Do(b); } else if (o is C c) { doer.Do(c); } else if (o is D d) { doer.Do(d); } else if (o is E e) { doer.Do(e); } else if (o is F f) { doer.Do(f); } }
public void Do(IDo o, Doer doer) { var a = o as A; var b = o as B; var c = o as C; var d = o as D; var e = o as E; var f = o as F; if (a != null) { doer.Do(a); } else if (b != null) { doer.Do(b); } else if (c != null) { doer.Do(c); } else if (d != null) { doer.Do(d); } else if (e != null) { doer.Do(e); } else if (f != null) { doer.Do(f); } }
public void Do(IDo o, Doer doer) { var type = o.GetType(); if (type == typeof(A)) { doer.Do((A)o); } else if (type == typeof(B)) { doer.Do((B)o); } else if (type == typeof(C)) { doer.Do((C)o); } else if (type == typeof(D)) { doer.Do((D)o); } else if (type == typeof(E)) { doer.Do((E)o); } else if (type == typeof(F)) { doer.Do((F)o); } }
public void Do(IDo o, Doer doer) { if (o is A) { ((A)o).Do(doer); } else if (o is B) { ((B)o).Do(doer); } else if (o is C) { ((C)o).Do(doer); } else if (o is D) { ((D)o).Do(doer); } else if (o is E) { ((E)o).Do(doer); } else if (o is F) { ((F)o).Do(doer); } }
public void Do(IDo o, Doer doer) { var handle = Type.GetTypeHandle(o); if (handle.Equals(s_a)) { doer.Do((A)o); } else if (handle.Equals(s_b)) { doer.Do((B)o); } else if (handle.Equals(s_c)) { doer.Do((C)o); } else if (handle.Equals(s_d)) { doer.Do((D)o); } else if (handle.Equals(s_e)) { doer.Do((E)o); } else if (handle.Equals(s_f)) { doer.Do((F)o); } }
public void Do(IDo o, Doer doer) { Action <Doer, object> actor; s_dict.TryGetValue(o.GetType(), out actor); actor(doer, o); }
public Hero(string name, Vector2d position) : base(name, position) { FullName = "Hero"; Foreground = ConsoleColor.Green; DrawLayer = Layer.Player; AttackAction = new Attack(this, null); _baseHealth = 100; }
static void Main(string[] args) { Console.WriteLine(System.UInt64.MaxValue); string str = "Картон"; Console.WriteLine($"Индекс первой буквы 'о' в слове {str} - " + str.IndexOf('о')); char[][] arrSt = new char[3][]; arrSt[0] = new char[1] { 'a' }; arrSt[1] = new char[2] { 'b', 'c' }; arrSt[2] = new char[3] { 'd', 'e', 'f' }; Console.WriteLine("\n"); for (int i = 0; i < 1; ++i) { Console.Write(arrSt[0][i] + " "); } Console.WriteLine(); for (int i = 0; i < 2; ++i) { Console.Write(arrSt[1][i] + " "); } Console.WriteLine(); for (int i = 0; i < 3; ++i) { Console.Write(arrSt[2][i] + " "); } Button b1 = new Button(100, 40); Button b2 = new Button(200, 36); bool res = b1.Equals(b2); Console.WriteLine("\nb1 эквивалентно b2? - " + res); Button.color = "синий"; Student st = new Student(); IThink st1 = st; IDo st2 = st; st1.Future(); st2.Future(); Console.ReadLine(); }
/// <summary> /// This method is the main loop for the spider threads. /// This method will wait for URL's to become available, /// and then process them. /// </summary> public void Process() { while (!t_manager.Quit) { m_ido = t_manager.ObtainWork(); t_manager.SpiderDone.WorkerBegin(); m_ido.threadManager = t_manager; m_ido.Start(); m_ido.Dispose(); t_manager.SpiderDone.WorkerEnd(); } }
public void addURL(IDo _do) { Monitor.Enter(this); if (!m_already.Contains(_do)) { //m_already.Add(_do, Status.STATUS_QUEUED); m_workload.Add(_do); } Monitor.Pulse(this); Monitor.Exit(this); }
public IDo ObtainWork() { Monitor.Enter(this); while (m_workload.Count < 1) { Monitor.Wait(this); } IDo next = m_workload.OrderBy(m => m.Priority).FirstOrDefault(); m_workload.Remove(next); Monitor.Exit(this); return(next); }
public static string stringForEyeID() { object IDo; bool isID = gazeDictionary.TryGetValue("id", out IDo); if (isID) { return(IDo.ToString()); } else { return(null); } }
public void Move(Vector2d newPos, BaseTile t) { if (canGoTo(t)) { Position = newPos; onTile = t; } // Cast til Base Enemy, hvis den tile jeg står på er en BaseEnemy BaseEnemy e = onTile as BaseEnemy; if (e != null) { onTile = e; AttackAction = new Attack(this, e); } // }
public void Do(IDo o, Doer doer) { switch (o) { case A a: doer.Do(a); break; case B b: doer.Do(b); break; case C c: doer.Do(c); break; case D d: doer.Do(d); break; case E e: doer.Do(e); break; case F f: doer.Do(f); break; } }
static void Main(string[] args) { Console.WriteLine(Decimal.MaxValue); Console.WriteLine("Введите две строки: "); string s1 = Console.ReadLine(); string s2 = Console.ReadLine(); int result = String.Compare(s1, s2); if (result == 0) { Console.WriteLine("Строки {0} и {1} идентичны", s1, s2); } else { Console.WriteLine("Строки {0} и {1} разные", s1, s2); } string[] arr = new string[3]; arr[0] = "один"; arr[1] = "два"; arr[2] = "три"; for (int i = arr.Length; i < 0; i--) { Console.Write(arr[i] + " "); } Month m = new Month(); Console.WriteLine("\nОбращение к элементам массива по индексу:"); Console.WriteLine(m[0]); Console.WriteLine(m[7]); Console.WriteLine(m[13]); Student st = new Student(); st.name = "Никита"; IDo inter_st = st; st.coding(); inter_st.coding(); Console.ReadLine(); }
public static async Task <HttpResponseMessage> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, [Inject(typeof(IDo))] IDo myDo, TraceWriter log) { string name = req.GetQueryNameValuePairs().FirstOrDefault(q => string.Compare(q.Key, "name", StringComparison.Ordinal) == 0).Value; dynamic data = await req.Content.ReadAsAsync <object>(); name = name ?? data?.name; string message = myDo.GetNameMessage(name); return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(JsonConvert.SerializeObject(message), Encoding.UTF8, "application/json") }); }
public void VirtualTry() { bool caught = false; IDo a = new ExcpetionClass(); IDo b = new B(); IDo a_ = null; IDo b_ = null; try { b_ = b.Do(); a_ = a.Do(); } catch (Exception e) { caught = true; } Assert.IsTrue(caught); Assert.IsTrue(b_ != null); Assert.IsTrue(a_ == null); }
public void DoWork(IDo task) { if (_isIdle) { _tasks.Enqueue(task); //Thread.Sleep(1); if (null == _thread) { _thread = new Thread(DoTask); _thread.IsBackground = true; _threadID = _thread.ManagedThreadId; _thread.Start(); } else { _newJobWaitHandle.Set(); } } else { throw (new ThreadStateException()); } }
public void AddNewWork(IDo task) { _tasks.Enqueue(task); }
public FooService(IDo @do) { Do = @do; }
public void Send(IDo command) { // TODO: error handling? tracer.Info("{0}: Sending command '{1}' to device.", Id, command.Topic); channel.SendAsync(new Topic(command.Topic, command.Payload)); }
public void Send(IDo command) { Commands.Add(command); }
public void Do(IDo o, Doer doer) { o.Do(doer); }
public void AddDo(IDo _do) { t_manager.addURL(_do); }
public void Do(IDo o, Doer doer) { }
public void Send(IDo command) { throw new NotSupportedException(); }
public void Do(IDo o, Doer doer) { s_dict[Type.GetTypeHandle(o)](doer, o); }