Example #1
0
        static void Main(string[] args)
        {
            string ace       = "acelee";
            string aceRevise = ace + "1";

            Prodcut p = new Prodcut();


            AnimalEnum dog = AnimalEnum.dog;

            AnimalEnum cat = AnimalEnum.cat;

            AnimalEnum dogequal = dog;

            Console.WriteLine(dog.GetHashCode());
            Console.WriteLine(cat.GetHashCode());

            Console.WriteLine(ace.GetHashCode());
            Console.WriteLine(aceRevise.GetHashCode());


            Prodcut a = new Prodcut {
                name = "casino"
            };
            Prodcut b = a;

            Console.WriteLine(a.GetHashCode() == b.GetHashCode());
            b = new Prodcut {
                name = "casino"
            };
            Console.WriteLine(a.GetHashCode() == b.GetHashCode());

            Console.WriteLine(a.GetHashCode());
            Console.WriteLine(b.GetHashCode());

            Console.Read();
            return;

            HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://www.p2p101.com/forum-356-1.html");

            req.Method = "GET";

            using (WebResponse wr = req.GetResponse())

            {
                using (StreamReader myStreamReader = new StreamReader(wr.GetResponseStream(), Encoding.UTF8))
                {
                    string    data       = myStreamReader.ReadToEnd();
                    string [] separators = new string[] { System.Environment.NewLine };
                    var       lines      = data.Split(separators, StringSplitOptions.RemoveEmptyEntries);

                    var test = lines
                               .Where(m => m.Contains("<a") && m.Contains("mod=viewthread"));

                    Console.WriteLine("data:" + lines.Count());
                }
            }
        }
Example #2
0
 public SimplePen(int avgPoopPerDay, int timeToRemovePoop, AnimalEnum type, int randomSeed)
 {
     this.avgPoopPerDay    = avgPoopPerDay;
     this.timeToRemovePoop = timeToRemovePoop;
     this.type             = type;
     this.KeepRunning      = true;
     random = new Random(randomSeed);
     SetupThread();
 }
Example #3
0
        /// <summary>
        /// 策略模式+工厂模式实现
        /// </summary>
        /// <param name="name"></param>
        /// <param name="age"></param>
        /// <param name="animal"></param>
        public Strategy(string name, int age, AnimalEnum animal)
        {
            switch (animal)
            {
            case AnimalEnum.Cat:
                _animail = new Cat(name, age);
                break;

            case AnimalEnum.Dog:
                _animail = new Dog(name, age);
                break;
            }
        }
        public override Animal CreateAnimal(AnimalEnum animal)
        {
            Animal animalObj;

            switch (animal)
            {
            case AnimalEnum.Lion:
                animalObj = new Lion();
                break;

            default:
                animalObj = new Lion();
                break;
            }
            return(animalObj);
        }
Example #5
0
        public override Animal CreateAnimal(AnimalEnum animal)
        {
            Animal animalObj;

            switch (animal)
            {
            case AnimalEnum.Cow:
                animalObj = new Cow();
                break;

            case AnimalEnum.Beer:
                animalObj = new Beer();
                break;

            default:
                animalObj = new Cow();
                break;
            }
            return(animalObj);
        }
 public abstract Animal CreateAnimal(AnimalEnum animal);
Example #7
0
 public RabbitPen(int avgPoopPerDay, int timeToRemovePoop, AnimalEnum type, int randomSeed) : base(avgPoopPerDay, timeToRemovePoop, type, randomSeed)
 {
 }
Example #8
0
 public RabbitPen(int avgPoopPerDay, int timeToRemovePoop, AnimalEnum type) : base(avgPoopPerDay, timeToRemovePoop, type)
 {
 }
Example #9
0
 public CanidaePen(int avgPoopPerDay, int timeToRemovePoop, AnimalEnum type, int randomSeed) : base(avgPoopPerDay, timeToRemovePoop, type, randomSeed)
 {
     poops = new List <Poop>();
 }
Example #10
0
 /// <summary>
 /// Create a new instance of an animal Card
 /// </summary>
 /// <param name="id">Identity of the card</param>
 /// <param name="month">Card month</param>
 /// <param name="animal">Animal type</param>
 public Card(int id, MonthEnum month, AnimalEnum animal)
     : this(id, FamilyEnum.Animal, month)
 {
     Animal = animal;
 }