Skip to content

Commit cb49784

Browse files
authored
Merge pull request #5221 from segmentio/niall/csharp_array
Add array info for CSharp
2 parents 45ff3db + eb5e566 commit cb49784

File tree

1 file changed

+12
-0
lines changed
  • src/connections/sources/catalog/libraries/server/csharp

1 file changed

+12
-0
lines changed

src/connections/sources/catalog/libraries/server/csharp/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,18 @@ The `reset` method clears the SDK’s internal stores for the current user and g
323323
analytics.Reset()
324324
```
325325

326+
## Arrays
327+
To send an array as an event property, reference the [GitHub repo](https://github.com/segmentio/Serialization.NET/blob/main/Tests/JsonUtilityTest.cs#L24){:target="_blank"}. Below is an example of code you can implement to send an array of strings:
328+
329+
```c#
330+
List<string> listOfStrings = new List<string> { "test1", "test2", "test3" };
331+
332+
JsonObject customerJsonObj = new JsonObject
333+
{
334+
["event_name"] = new JsonArray(listOfStrings.ConvertAll(o => (JsonElement)o))
335+
};
336+
```
337+
326338
## Compatibility
327339
This library targets `.NET Standard 2.0`. See the [list of compatible platforms](https://docs.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0){:target="_blank"}.
328340

0 commit comments

Comments
 (0)