當前位置: 首頁>>代碼示例>>C#>>正文


C# Child類代碼示例

本文整理匯總了C#中Child的典型用法代碼示例。如果您正苦於以下問題:C# Child類的具體用法?C# Child怎麽用?C# Child使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Child類屬於命名空間,在下文中一共展示了Child類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetUp

 public void SetUp()
 {
     this._parent = new Parent();
     this._child = new Child();
     this._parent.Child = this._child;
     this._child.Parent = this._parent;
 }
開發者ID:calebjenkins,項目名稱:Highway.Data,代碼行數:7,代碼來源:CloneExtensionCircularReferenceTests.cs

示例2: InheritanceIsRespected

 public void InheritanceIsRespected()
 {
     var parent = new Parent().GetChangeType();
     var child = new Child().GetChangeType();
     Assert.IsFalse(parent.IsA(typeof(Child)));
     Assert.IsTrue(child.IsA(typeof(Parent)));
 }
開發者ID:NiSHoW,項目名稱:FrameLogCustom,代碼行數:7,代碼來源:ChangeTypeTests.cs

示例3: UpdateCoverArt

        private void UpdateCoverArt(Task<IImageFormat<Image>> task, Child child)
        {
            switch (task.Status)
            {
                case TaskStatus.RanToCompletion:
                    if (task.Result == null)
                        return;

                    using (_currentAlbumArt = task.Result.Image)
                    {
                        if (_currentAlbumArt != null)
                        {
                            string localFileName = GetCoverArtFilename(child);

                            try
                            {
                                _currentAlbumArt.Save(localFileName);

                                Dispatcher.Invoke(() => MusicCoverArt.Source = _currentAlbumArt.ToBitmapSource().Resize(BitmapScalingMode.HighQuality, true, (int)(MusicCoverArt.Width * ScalingFactor), (int)(MusicCoverArt.Height * ScalingFactor)));
                            }
                            catch(Exception)
                            {
                            }
                        }
                    }

                    task.Result.Dispose();

                    break;
            }
        }
開發者ID:archrival,項目名稱:UltraSonic,代碼行數:31,代碼來源:MainWindowTasks.cs

示例4: Test

        public void Test()
        {
            Family family = new Family();
            Child child1 = new Child(1);
            Child child2 = new Child(2);
            Parent parent = new Parent(new List<Child>() {child1, child2});
            family.Add(parent);

            string file = "sandbox.txt";

            try
            {
                File.Delete(file);
            }
            catch
            {
            }

            using (var fs = File.OpenWrite(file))
            {
                Serializer.Serialize(fs, family);
            }
            using (var fs = File.OpenRead(file))
            {
                family = Serializer.Deserialize<Family>(fs);
            }

            System.Diagnostics.Debug.Assert(family != null, "1. Expect family not null, but not the case.");
        }
開發者ID:Erguotou,項目名稱:protobuf-net,代碼行數:29,代碼來源:SO7219959.cs

示例5: Parent

 public Parent(Child[] children)
 {
     foreach (var child in children)
     {
         child.Events.AddListenerStream(_childEvents);
     }
 }
開發者ID:Cooke,項目名稱:EventStream,代碼行數:7,代碼來源:Program.cs

示例6: TestAccessToProtected

		public int TestAccessToProtected (Child c)
		{
			if (c.a == 0)
				return 1;
			else
				return 2;
		}
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:7,代碼來源:test-174.cs

示例7: TypeEqualityIsRespected

 public void TypeEqualityIsRespected()
 {
     var parent = new Parent().GetChangeType();
     var child = new Child().GetChangeType();
     Assert.IsTrue(parent.IsA(typeof(Parent)));
     Assert.IsTrue(child.IsA(typeof(Child)));
 }
開發者ID:NiSHoW,項目名稱:FrameLogCustom,代碼行數:7,代碼來源:ChangeTypeTests.cs

示例8: Button1_Click

        protected void Button1_Click(object sender, EventArgs e)
        {
            Service1Client service = new WCFWebReference.Service1Client();

            string userName = UserNameTB.Text;
            string password = service.GetHashedPassword(UserPasswordTB.Text);
            Person obj = service.Login(userName, password);

            if (obj != null)
            {
                if (obj.GetType() == typeof(Child))
                {
                    child = (Child)obj;
                    Response.Redirect("Default.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Teachers cannot log in using this platform. /nPlease use the windows software')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('No user found')</script>");
            }
        }
開發者ID:IliyanStoev,項目名稱:dmai0914_Sem3_Gr1,代碼行數:25,代碼來源:LogIn.aspx.cs

示例9: convertMainObjectToCommunityMember

        public CommunityMember convertMainObjectToCommunityMember(MainObjectFromCsvFileInfo mainObject)
        {
            CommunityMember communityMemberVm = new CommunityMember();

            if(string.IsNullOrWhiteSpace(mainObject.FatherFirstName) && string.IsNullOrWhiteSpace(mainObject.FatherLastName)) {
                communityMemberVm.FirstName = string.IsNullOrWhiteSpace(mainObject.MotherFirstName) ? "N/A" : mainObject.MotherFirstName;
                communityMemberVm.LastName = string.IsNullOrWhiteSpace(mainObject.MotherLastName) ? "N/A" : mainObject.MotherLastName;
            } else {
                communityMemberVm.FirstName = string.IsNullOrWhiteSpace(mainObject.FatherFirstName)? "N/A" : mainObject.FatherFirstName;
                communityMemberVm.LastName = string.IsNullOrWhiteSpace(mainObject.FatherLastName)? "N/A" : mainObject.FatherLastName;
                communityMemberVm.SpouseFirstName = string.IsNullOrWhiteSpace(mainObject.MotherFirstName)? "N/A" : mainObject.MotherFirstName;
                communityMemberVm.SpouseLastName = string.IsNullOrWhiteSpace(mainObject.MotherLastName)? "N/A" : mainObject.MotherLastName;
            }
            communityMemberVm.PhoneNumber = mainObject.FatherPhone;
            communityMemberVm.SpousePhoneNumber = mainObject.MotherPhone;
            communityMemberVm.Email = "[email protected]";

            if (mainObject.Children != null && mainObject.Children.Count() > 0)
            {
                communityMemberVm.Children = new List<Child>();
                for (int i = 0; i < mainObject.Children.Count(); i++)
                {
                    var mainObjectChild = mainObject.Children[i];
                    Child child = new Child();
                    child.FirstName = mainObjectChild.ChildFirstName;
                    child.LastName = string.IsNullOrWhiteSpace(communityMemberVm.LastName) ? "" : communityMemberVm.LastName;
                    child.Gender = mainObjectChild.Gender;
                    child.DateOfBirth = new Extentions().getDobFromAge(mainObjectChild.Age);
                    communityMemberVm.Children.Add(child);

                }
            }

            return communityMemberVm;
        }
開發者ID:ahmadabdul3,項目名稱:asp-net-angular,代碼行數:35,代碼來源:Extentions.cs

示例10: Main

        static void Main(string[] args)
        {
            Child child = new Child();

            // Previously null checks were needed before accessing a parent property.
            string grandParentNameOld = "No name found";

            if (child.Parent != null)
                if (child.Parent.GrandParent != null)
                    grandParentNameOld = child.Parent.GrandParent.Name;

            // C# 6: If any property is null, a null result is returned immediately.
            // Can be conveniently used with the null-coalescing operator.
            string grandParentNameNew = child.Parent?.GrandParent?.Name ?? "No name found";

            Console.WriteLine(grandParentNameOld);
            Console.WriteLine(grandParentNameNew);

            // C# 6: Also works with indexers.
            int[] arr = null;
            int foundOld = arr != null ? arr[1337] : 0;
            int foundNew = arr?[1337] ?? 0;

            // Can't use Null-conditional operator to call a delegate directly.
            // But can be used by calling the Invoke method.
            Func<string, string> func = null;
            string result = func?.Invoke("Not invoked");
            //string result = func?(); // Syntax not supported

            // The Null-conditional operator is nice to use when raising events.
            // The call is thread-safe, since the reference is held in a temporary variable.
            PropertyChanged?.Invoke(null, null);

            Console.Read();
        }
開發者ID:peter-h4nsen,項目名稱:csharp-features,代碼行數:35,代碼來源:Program.cs

示例11: ChildViewModel

 public ChildViewModel(Child child)
 {
     Birthday = child.Birthday;
     FullName = child.FullName;
     Id = child.Id;
     Addres = child.Addres;
 }
開發者ID:GenaFox,項目名稱:OPP_Project,代碼行數:7,代碼來源:ChildViewModel.cs

示例12: PropertyAccessorAccessibilityTest

        public void PropertyAccessorAccessibilityTest()
        {
            Parent parent = new Parent();
            Assert.AreEqual("parent", parent.Name);

            Child child = new Child();
            Assert.AreEqual("child", child.Name);
        }
開發者ID:ohyecloudy,項目名稱:csharp-features,代碼行數:8,代碼來源:PropertyAccessorAccessibilityTests.cs

示例13: SetUp

        public void SetUp()
        {
            parent = new Parent("Mike Hadlow", "[email protected]", "pwd");
            child = parent.CreateChild("Leo", "leohadlow", "xxx");

            somebodyElse = new Parent("John Robinson", "[email protected]", "pwd");
            somebodyElsesChild = somebodyElse.CreateChild("Jim", "jimrobinson", "yyy");
        }
開發者ID:sharparchitecture,項目名稱:Sharp-Architecture,代碼行數:8,代碼來源:MakePaymentTests.cs

示例14: AddChild

 public ActionResult AddChild(Child child)
 {
     if (ModelState.IsValid)
     {
         return Json(membersRepo.AddChild(child), JsonRequestBehavior.AllowGet);
     }
     return Json(ErrorMessages.getErrorFieldsEmptyServerResponse(), JsonRequestBehavior.AllowGet);
 }
開發者ID:ahmadabdul3,項目名稱:asp-net-angular,代碼行數:8,代碼來源:MembersController.cs

示例15: Main

    public static void Main()
    {
        Child child = new Child();

        child.print();

        ((Parent)child).print();
    }
開發者ID:JeremiahZhang,項目名稱:AKA,代碼行數:8,代碼來源:BaseTalk.cs


注:本文中的Child類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。