本文整理汇总了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);
}
示例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);
}