Count() Methods
v4.0
Count()
Count()
You can count the items in the list. Each Game Modules list has a List<>
in it, so while you could call gameModulesList.list.Count
, we've added these methods.
// Count all in the list
Debug.Log($"There are {gameStatList.Count()} stats in the gameStatList.");
// Add in a uid to only count the objects with that uid
Debug.Log($"There are {gameStatList.Count(uid)} stats in the list with " +
$"the named {statsRepository.GetByUid(uid).objectName}");
// Count the number of a specific objectType
var objectType = "Weapon Skill";
Debug.Log($"There are {gameStatList.CountObjectType(objectType)} {objectType} objects " +
$"in the list.");
// Get the number of unique objects, based on the uid
Debug.Log($"There are {gameStatList.CountUnique} unique stats in the list");
// Get the number of duplicates, excluding the first of each
Debug.Log($"There are {gameStatList.CountDuplicates()} additional duplicate items " +
$"beyond the first of each uid");
// Get the number of duplicates of a specific objectType, excluding the first of each
Debug.Log($"There are {gameStatList.CountDuplicatesOfType(objectType)} additional " +
$"duplicate items of type {objectType} beyond the first of each");
// Get the number of different objectTypes
Debug.Log($"There are {gameStatList.CountTypes()} objectTypes in the list");
Last updated
Was this helpful?