---
title: "CFBagGetCountOfValue(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfbaggetcountofvalue(_:_:)"
---

# CFBagGetCountOfValue(_:_:)

Returns the number of times a value occurs in a bag.

## Declaration

```swift
func CFBagGetCountOfValue(_ theBag: CFBag!, _ value: UnsafeRawPointer!) -> CFIndex
```

## Parameters

- `theBag`: The bag to examine.
- `value`: The value for which to find matches in theBag. The equal callback provided when theBag was created is used to compare. If the equal callback was NULL, pointer equality (in C, ==) is used. If value, or any other value in theBag, is not understood by the equal callback, the behavior is undefined.

## Return Value

Return Value The number of times value occurs in theBag.

## See Also

### Examining a Bag

- [CFBagContainsValue(_:_:)](corefoundation/cfbagcontainsvalue(_:_:).md)
- [CFBagGetCount(_:)](corefoundation/cfbaggetcount(_:).md)
- [CFBagGetValue(_:_:)](corefoundation/cfbaggetvalue(_:_:).md)
- [CFBagGetValueIfPresent(_:_:_:)](corefoundation/cfbaggetvalueifpresent(_:_:_:).md)
- [CFBagGetValues(_:_:)](corefoundation/cfbaggetvalues(_:_:).md)
