下划线标记的源代码解决方案!

时间:2010-10-22 15:58:34

标签: c# c#-4.0

怎么了家伙!

我需要一些帮助!

此代码内部“返回ControllTheDog(D, _ __ _ _ ));部分” _ __ _ _ “需要在C sharp中添加特定代码。

在方法“NeedInjection”或/和“Dehydration”而不是“ _ ___ ”之间进行选择的解决方案是什么?努力寻找解决方案,但我仍然无法解决。

// FullmetalBoy

using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Text;

    namespace ConsoleApplication1 {




            public class Program
            {
                static void Main(string[] args)
                {

                    Dog myDog = new Dog();

                    Doctor myDoctor = new Doctor();

                    myDoctor.GoToDoctor(myDog);

                }
            }



            public delegate bool Validation(Dog D);

            public class Doctor
            {

                public bool GoToDoctor(Dog D)
                {
                    return ControllTheDog(D, ______________ ));
                }




                private bool ControllTheDog(Dog D, Validation ValidationControl)
                {
                    return ValidationControl(D);
                }



                public bool NeedInjection(Dog D)
                { 
                    return true;
                }

                public bool Dehydration(Dog D)
                { 
                    return false;
                }

            }



            public class Dog
            {


            }



        }

1 个答案:

答案 0 :(得分:1)

你在找这样的东西吗?

return ControllTheDog(D, (DateTime.Now.DayOfWeek == DayOfWeek.Tuesday)
                         ? new Validation(NeedInjection)
                         : new Validation(Dehydration));