> For the complete documentation index, see [llms.txt](https://infinitypbr.gitbook.io/magic-pig-games/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://infinitypbr.gitbook.io/magic-pig-games/game-modules-4/module-documentation/game-module-lists/count-methods.md).

# Count() Methods

{% hint style="info" %}
Example code here is from `GameStatList.cs`, though similar methods are on other list classes as well.

Methods for specific list types are below.
{% endhint %}

{% hint style="info" %}
The common methods can be found in `GameModuleListExtensions.cs`
{% endhint %}

## `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.

```csharp
// 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");
```
