mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
Better name for TryFirst extension method
This commit is contained in:
parent
79621dcfda
commit
71b3c5ad2a
2 changed files with 4 additions and 4 deletions
|
|
@ -53,12 +53,12 @@ namespace ICD.Common.Utils.Extensions
|
|||
/// <param name="extends"></param>
|
||||
/// <param name="item">Outputs the first item in the sequence.</param>
|
||||
/// <returns></returns>
|
||||
public static bool TryFirstOrDefault<T>(this IEnumerable<T> extends, out T item)
|
||||
public static bool TryFirst<T>(this IEnumerable<T> extends, out T item)
|
||||
{
|
||||
if (extends == null)
|
||||
throw new ArgumentNullException("extends");
|
||||
|
||||
return extends.TryFirstOrDefault(i => true, out item);
|
||||
return extends.TryFirst(i => true, out item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -69,7 +69,7 @@ namespace ICD.Common.Utils.Extensions
|
|||
/// <param name="predicate"></param>
|
||||
/// <param name="item">Outputs the first item in the sequence.</param>
|
||||
/// <returns></returns>
|
||||
public static bool TryFirstOrDefault<T>(this IEnumerable<T> extends, Func<T, bool> predicate, out T item)
|
||||
public static bool TryFirst<T>(this IEnumerable<T> extends, Func<T, bool> predicate, out T item)
|
||||
{
|
||||
if (extends == null)
|
||||
throw new ArgumentNullException("extends");
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace ICD.Common.Utils.Xml
|
|||
public static IcdXmlAttribute GetAttribute(string xml, string name)
|
||||
{
|
||||
IcdXmlAttribute output;
|
||||
if (GetAttributes(xml).TryFirstOrDefault(a => a.Name == name, out output))
|
||||
if (GetAttributes(xml).TryFirst(a => a.Name == name, out output))
|
||||
return output;
|
||||
|
||||
throw new KeyNotFoundException(string.Format("No attribute with name {0}", name));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue