static void Main(string[] args) { Dictionary <ProcessSupport, string> ClientProcess = new Dictionary <ProcessSupport, string>(); ProcessSupport ps1 = new ProcessSupport("um", "tcp:\\localhost:9000"); ProcessSupport ps2 = new ProcessSupport("dois", "tcp:\\localhost:9001"); ProcessSupport ps3 = new ProcessSupport("tres", null); ClientProcess.Add(ps1, "A"); ClientProcess.Add(ps2, "B"); ClientProcess.Add(ps3, "C"); try { Console.WriteLine("RES: " + ClientProcess[ps1]); ClientProcess.Remove(ps2); Console.WriteLine("RES: " + ClientProcess[ps1]); if (ClientProcess.ContainsKey(ps3)) { Console.WriteLine("Tenho: " + ClientProcess[ps3]); } Console.ReadLine(); } catch (Exception) { Console.WriteLine("Não Existe"); Console.ReadLine(); } }
public override bool Equals(object obj) { if (obj == null) { return(false); } ProcessSupport t = obj as ProcessSupport; if (t == null) { return(false); } return(Processname.Equals(t.GetProcessname())); }