当前位置: 首页>>代码示例>>C#>>正文


C# ItemId.ToString方法代码示例

本文整理汇总了C#中ItemId.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ItemId.ToString方法的具体用法?C# ItemId.ToString怎么用?C# ItemId.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ItemId的用法示例。


在下文中一共展示了ItemId.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ItemIdConstructors

        public void ItemIdConstructors()
        {
            // ItemId uses ContentType() of the relevant type
            Guid id1 = Guid.NewGuid();
            Type extType = CompositeTypeManager.Instance.ExtendedTypes[typeof(TestData)];
            var ii1 = new ItemId(extType, id1);
            Assert.AreEqual(typeof(TestData), ii1.Type);

            // Serialize/Deserialize
            var ii2 = new ItemId(ii1.ToString());
            Assert.AreEqual(ii2.Type, ii1.Type);
            Assert.AreEqual(ii2.Id, ii1.Id);
            Assert.AreEqual(ii2, ii1);

            // Construct from basic type
            TestData td = Collator.Instance.GetNew<TestData>(new Address(typeof(TestData), "a"));
            td.Id = 5;
            var ii3 = new ItemId(td);
            Assert.AreEqual(ii3.Id, td.Id);

            // Construct from container
            Guid id = Guid.NewGuid();
            Guid ident = Guid.NewGuid();
            ContentItem ci = new ContentItem { Id = id, Identity = ident, DataType = typeof(RestaurantContent).FullName };
            var ii4 = new ItemId(ci);
            Assert.AreEqual(ii4.Id, ident);
            Assert.AreEqual(ii4.Type, typeof(RestaurantContent));

            // Construct from data item
            RestaurantContent rc = Collator.Instance.GetNew<RestaurantContent>(new Address(typeof(RestaurantContent), "x"));
            var ii5 = new ItemId(rc);
            Assert.AreEqual(ii5.Id, rc.Identity);

            // Construct from summary
            RestaurantSummary rs = Collator.Instance.GetSummary<RestaurantSummary>(rc);
            var ii6 = new ItemId(rs);
            Assert.AreEqual(ii6.Id, rs.Id);
            Assert.AreEqual(ii6.Type, rs.Type);
        }
开发者ID:jamesej,项目名称:lynicon,代码行数:39,代码来源:ItemIdTests.cs

示例2: RecycleItem

        public async Task<RecycleInventoryItemResponse> RecycleItem(ItemId itemId, int amount)
        {
            var customRequest = new RecycleInventoryItem
            {
                ItemId = (ItemId)Enum.Parse(typeof(ItemId), itemId.ToString()),
                Count = amount
            };

            var releasePokemonRequest = RequestBuilder.GetRequest(_unknownAuth, CurrentLat, CurrentLng, CurrentAltitude,
                new Request.Types.Requests
                {
                    Type = (int)RequestType.RECYCLE_INVENTORY_ITEM,
                    Message = customRequest.ToByteString()
                });
            return await _httpClient.PostProtoPayload<Request, RecycleInventoryItemResponse>($"https://{_apiUrl}/rpc", releasePokemonRequest);
        }
开发者ID:C-Sto,项目名称:Pokemon-Go-Rocket-API,代码行数:16,代码来源:Client.cs


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