• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Child类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Child的典型用法代码示例。如果您正苦于以下问题:C# Child类的具体用法?C# Child怎么用?C# Child使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Child类属于命名空间,在下文中一共展示了Child类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: AddNewAndCheckParent

 public void AddNewAndCheckParent()
 {
     var cl = new TstClient();
     var pr = cl.GetRoot<Root>().ParentItems.First();
     var child = new Child {Value = 99.9};
     pr.Children.Add(child);
     Assert.AreEqual(true, pr.Children.Contains(child));
     Assert.AreEqual(pr, child.Parent);
 }
开发者ID:Foxbow74,项目名称:x-transport,代码行数:9,代码来源:TestChilds.cs


示例17: Undo

 public void Undo()
 {
     var cl = new TstClient();
     var pr = cl.GetRoot<Root>().ParentItems.First();
     var clientSideChild = new Child {Value = 3.0};
     pr.Children.Add(clientSideChild);
     cl.Undo(pr.Uid);
     Assert.AreEqual(2, pr.Children.Count);
 }
开发者ID:Foxbow74,项目名称:x-transport,代码行数:9,代码来源:TestLists.cs


示例18: LostChild

 public void LostChild(Child lost)
 {
     thePlayer.SendMessage("AddScore", -100.0f);
     thePlayer.SendMessage("LoseLife");
     Player p = thePlayer.gameObject.GetComponent<Player>();
     p.children.Remove(lost);
     ChangePhase(mourning);
     messageGUI.DisplayMessage("You lost your child! Be more careful.");
 }
开发者ID:iamseb,项目名称:RGJ05LoveWars,代码行数:9,代码来源:MissionManager.cs


示例19: Main

 public static void Main(string[] args)
 {
     System.Console.WriteLine("Child c1 = new Child();");
     Child c1 = new Child();
     System.Console.WriteLine("\n\n");
     // Notice that static constructors are only run ONCE per class.
     System.Console.WriteLine("Child c2 = new Child(5)");
     Child c2 = new Child(5);
 }
开发者ID:katnegermis,项目名称:JCD2014,代码行数:9,代码来源:object_creation_order.cs


示例20: Start

	void Start () 
	{
		left = Screen.width / 9;
		top = Screen.height / 9;
		width = 400f;
		height = 400f;
		asl = GameObject.Find("ASL").GetComponent<ASL>();
		anotherPlayer = GameObject.Find("AnotherPlayer").GetComponent<AnotherPlayer>();
		child = GameObject.Find("Child").GetComponent<Child>();
	}
开发者ID:Zelious,项目名称:FollowingSubZeroGamesTutorials,代码行数:10,代码来源:GUIManager.cs



注:本文中的Child类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ChocolateyConfiguration类代码示例发布时间:2022-05-24
下一篇:
C# ChessPiece类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap