本文整理汇总了C#中Bucket.GetKeys方法的典型用法代码示例。如果您正苦于以下问题:C# Bucket.GetKeys方法的具体用法?C# Bucket.GetKeys怎么用?C# Bucket.GetKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bucket
的用法示例。
在下文中一共展示了Bucket.GetKeys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClearBucket
private IEnumerator ClearBucket(Bucket bucket)
{
// Get all keys in the given bucket.
var getKeysRequest = bucket.GetKeys();
yield return getKeysRequest.WaitUntilDone();
if (getKeysRequest.hasFailed)
{
Debug.LogError("Unable to clear " + bucket + ". " + getKeysRequest.GetErrorString());
yield break;
}
// Remove each one of the keys. Issue the requests all at once.
var removeRequests = new List<RemoveRequest>();
foreach (var key in getKeysRequest.GetKeyEnumerable())
{
removeRequests.Add(bucket.Remove(key));
}
// Then wait for each request to finish.
foreach (var removeRequest in removeRequests)
{
yield return removeRequest.WaitUntilDone();
if (removeRequest.hasFailed)
Debug.LogError("Unable to remove '" + removeRequest.key + "' from " + removeRequest.bucket + ". " +
removeRequest.GetErrorString());
}
// Finally refresh the list.
StartCoroutine(RefreshList());
}