Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
IEquatable_Object compare
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public delegate bool comp<T>(T t); public delegate bool comp<T,V>(T t,V v); public class ByOne<T,V>:IEquatable<T> { public T t; public V v; public ByOne(T a) { t=a; } public ByOne(T a,V b) { t=a; v=b; } public ByOne() { t=default(T); v=default(V); } public bool Equals(T tp) { if(this.Equals(tp)) return true; else return false; } public bool Equals(T tp,V vp) { if(tp.Equals(vp)) { Console.WriteLine("in Equals"); return true; } else { Console.WriteLine("in Equals"); return false; } } /* public bool Equals(V vp) { if(this.Equals(vp)) return true; else return false; }*/ } public class Program { public static void Main(string[] args) { Console.WriteLine("ByOne\n\n"); int me1=10; double me2=15.2; byte me3=10; float me4=6.1F; ByOne<int,double> bone=new ByOne<int,double>(me1,me2); ByOne<int,double> bone1=new ByOne<int,double>(me3,me2); ByOne<int,double> bone2=new ByOne<int,double>(me3,me4); ByOne<object,object> bone3=new ByOne<object,object>(bone,bone1); ByOne<object,object> bone4=new ByOne<object,object>(bone1,bone2); ByOne<object,object> bone5=new ByOne<object,object>(bone); ByOne<object,object> bone6=new ByOne<object,object>(bone5); Console.WriteLine(me1.Equals(me2)); Console.WriteLine(me1.Equals(me1)); Console.WriteLine(me2.Equals(me1)); Console.WriteLine("------------------"); Console.WriteLine(); bone6=bone5; bool stat=bone3.Equals(bone6,bone5); Console.WriteLine(stat); } } }
run
|
edit
|
history
|
help
0
static, private, public constructor in C#
How to count the occurrence of each character in a string?
Print All Cards
Singleton Example
Greatest Common Divisor of 2 or more numbers.
List Compare and print - Except
latest Iequatable
code
Operator Overloading Example (+, -, *, /, ==, !=)
nikk