aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.Burn/TableExtensions.cs
blob: 465bf870cb6872e3a83540d12a656c93b22e13a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.

namespace WixToolset.Core.Burn
{
    using System.Collections.Generic;
    using System.Linq;
    using WixToolset.Data.WindowsInstaller;

    /// <summary>
    /// Methods that extend <see cref="Table"/>.
    /// </summary>
    public static class TableExtensions
    {
        /// <summary>
        /// Gets the rows contained in the table as a particular row type.
        /// </summary>
        /// <param name="table">Table to get rows from.</param>
        /// <remarks>If the <paramref name="table"/> is null, an empty enumerable will be returned.</remarks>
        public static IEnumerable<T> RowsAs<T>(this Table table) where T : Row
        {
            return (null == table) ? Enumerable.Empty<T>() : table.Rows.Cast<T>();
        }
    }
}