< Summary

Class:Microsoft.Azure.Search.Common.EnumerableExtensions
Assembly:Microsoft.Azure.Search.Common
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Common\src\Customizations\Search\Common\EnumerableExtensions.cs
Covered lines:3
Uncovered lines:0
Coverable lines:3
Total lines:34
Line coverage:100% (3 of 3)
Covered branches:4
Total branches:4
Branch coverage:100% (4 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
ToCommaSeparatedString(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Common\src\Customizations\Search\Common\EnumerableExtensions.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5namespace Microsoft.Azure.Search.Common
 6{
 7    using System;
 8    using System.Collections.Generic;
 9    using System.Linq;
 10
 11    /// <summary>
 12    /// Defines extension methods for IEnumerable that are used in the implementation of the Azure Cognitive Search
 13    /// .NET SDK.
 14    /// </summary>
 15    public static class EnumerableExtensions
 16    {
 17        /// <summary>
 18        /// Converts the elements of a collection to strings and concatenates them into a comma-separated list,
 19        /// or returns null for null or empty collections.
 20        /// </summary>
 21        /// <typeparam name="T">The type of elements that will be converted to strings.</typeparam>
 22        /// <param name="enumerable">The collection to turn into a comma-separated string.</param>
 23        /// <returns>A comma-separated string, or null if enumerable is null or empty.</returns>
 24        public static string ToCommaSeparatedString<T>(this IEnumerable<T> enumerable)
 25        {
 62426            if (enumerable == null || !enumerable.Any())
 27            {
 41428                return null;
 29            }
 30
 19831            return String.Join(",", enumerable);
 32        }
 33    }
 34}

Methods/Properties

ToCommaSeparatedString(...)