Skip to content

Commit

Permalink
Merge pull request #77 from Azure/75-trigger-publisher-on-configurati…
Browse files Browse the repository at this point in the history
…on-file-change

75 trigger publisher on configuration file change
  • Loading branch information
waelkdouh authored Jun 27, 2022
2 parents 0c826cf + 469f84f commit 57e55d6
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 90 deletions.
32 changes: 32 additions & 0 deletions tools/code/common/Enumerable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace common;

public static class IEnumerableModule
{
/// <summary>
/// Applies <paramref name="f"/> to <paramref name="enumerable"/> items and filters out
/// null results.
/// </summary>
public static IEnumerable<T2> Choose<T, T2>(this IEnumerable<T> enumerable, Func<T, T2?> f) where T2 : class
{
return from t in enumerable
let t2 = f(t)
where t2 is not null
select t2;
}

/// <summary>
/// Applies <paramref name="f"/> to <paramref name="enumerable"/> items and filters out
/// null results.
/// </summary>
public static IEnumerable<T2> Choose<T, T2>(this IEnumerable<T> enumerable, Func<T, T2?> f) where T2 : struct
{
return from t in enumerable
let t2 = f(t)
where t2 is not null
select t2.Value;
}
}
Loading

0 comments on commit 57e55d6

Please sign in to comment.