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


C# Actor.Deserialize方法代碼示例

本文整理匯總了C#中Actor.Deserialize方法的典型用法代碼示例。如果您正苦於以下問題:C# Actor.Deserialize方法的具體用法?C# Actor.Deserialize怎麽用?C# Actor.Deserialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Actor的用法示例。


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

示例1: DeserializeTestFailedNoNode

        public void DeserializeTestFailedNoNode()
        {
            Actor target = new Actor();
            ArgumentNullException expected = new ArgumentNullException("node", "Provided node must not be null.");
            ArgumentNullException actual = Assert.Throws<ArgumentNullException>(() => target.Deserialize(null));

            Assert.Equal(expected.Message, actual.Message);
        }
開發者ID:StefanZi,項目名稱:TheTVDBApi,代碼行數:8,代碼來源:ActorTest.cs

示例2: DeserializeTestSuccessfull

        public void DeserializeTestSuccessfull()
        {
            string xmlContent =
                "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><Actors><Actor><id>79415</id><Image>actors/79415.jpg</Image><Name>Nathan Fillion</Name><Role>Richard Castle</Role><SortOrder>0</SortOrder></Actor></Actors>";

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(xmlContent);

            System.Xml.XmlNode actoresNode = doc.ChildNodes[1];
            System.Xml.XmlNode actorNode = actoresNode.ChildNodes[0];
            Actor target = new Actor();
            target.Deserialize(actorNode);

            Assert.Equal(79415, target.Id);
            Assert.Equal("actors/79415.jpg", target.ImagePath);
            Assert.Equal("Nathan Fillion", target.Name);
            Assert.Equal("Richard Castle", target.Role);
            Assert.Equal(0, target.SortOrder);
        }
開發者ID:StefanZi,項目名稱:TheTVDBApi,代碼行數:19,代碼來源:ActorTest.cs

示例3: DeserializeActors

        /// <summary>
        /// Deserializes all actors of the series.
        /// </summary>
        private void DeserializeActors()
        {
            if (this.actorsDoc == null || this.actorsDoc.ChildNodes.Count == 0)
            {
                return;
            }

            this.Actors = new List<Actor>();
            XmlNode actorsNode = this.actorsDoc.ChildNodes[1];

            foreach (XmlNode currentNode in actorsNode)
            {
                if (currentNode.Name.Equals("Actor", StringComparison.OrdinalIgnoreCase))
                {
                    Actor deserializes = new Actor();
                    deserializes.Deserialize(currentNode);

                    this.Actors.Add(deserializes);
                }
            }
        }
開發者ID:StefanZi,項目名稱:TheTVDBApi,代碼行數:24,代碼來源:SeriesDetails.cs


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