# Utils.DictionaryToString(ICollection&lt;KeyValuePair&lt;T1, T2&gt;&gt;, Func&lt;T2, string?&gt;, string?)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.utils/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.utils/methods/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/Utils/Utils.cs#L83-L113)

```csharp
public static string DictionaryToString<T1, T2>(ICollection<KeyValuePair<T1, T2>> dict, Func<T2, string?>? toString = null, string? separator = null)
```

Returns a human-readable text string that describes a dictionary that maps objects to objects.

### Parameters

- `dict` (`ICollection<KeyValuePair<T1, T2>>`): The dictionary to describe.
- `toString` (`Func<T2, string?>`): Converts the element to a string. If none specified, `System.Object.ToString` will be used.
- `separator` (`string?`): The separator to use. If none specified, the elements should appear separated by a new line.

### Returns

A string assembled by wrapping the string descriptions of the individual pairs with square brackets and separating them with commas. Each key-value pair is represented as the string description of the key followed by the string description of the value, separated by " -&gt; ", and enclosed in curly brackets.
