示例#1
0
        // Struct = Immutable object
        // Tuples = Anonymous Immutable object
        // Class = Mutable object

        public static void Run()
        {
            // Oneliner
            Str1 str4 = new Str1 {
                name = "Joe", age = 44
            };

            Str1 str1;

            str1.name = "Joe";
            str1.age  = 44;
            str1.doSomething();
            Console.WriteLine(str1.getSomething());


            Str2 str2 = new Str2("Joe", 44);

            str2.doSomething();
            Console.WriteLine(str2.getSomething());

            Str3 str3 = new Str3();

            str3.name = "Joe";
            str3.age  = 44;
            str3.doSomething();
            Console.WriteLine(str3.getSomething());
        }
    static void Main(string[] args)
    {
        Str1 A = new Str1("text");
        Str2 B = A.Method(2);

        Console.WriteLine(B.symb);
        Console.ReadKey();
    }
示例#3
0
        public override bool Equals(object obj)
        {
            var other = obj as ExtendedBaseEntity;

            if (other == null)
            {
                return(false);
            }
            if (!base.Equals(obj))
            {
                return(false);
            }

            if (Number2 != other.Number2)
            {
                return(false);
            }
            return(Str2 == null ? other.Str2 == null : Str2.Equals(other.Str2));
        }
示例#4
0
 public static bool operator !=(string Str1, CodeString Str2)
 {
     return(!Str2.IsEqual(Str1));
 }
示例#5
0
 public override int GetHashCode()
 {
     return(base.GetHashCode() ^ (Str2 == null ? 0 : Str2.GetHashCode()) ^ Number2);
 }