mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-07 08:45:12 +00:00
feat: Cross-platform extension for determining if a ParameterInfo represents an "out" parameter
This commit is contained in:
29
ICD.Common.Utils/Extensions/ParameterInfoExtensions.cs
Normal file
29
ICD.Common.Utils/Extensions/ParameterInfoExtensions.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
#if SIMPLSHARP
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
#else
|
||||
using System.Reflection;
|
||||
#endif
|
||||
|
||||
namespace ICD.Common.Utils.Extensions
|
||||
{
|
||||
public static class ParameterInfoExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the given parameter is an "out" parameter.
|
||||
/// </summary>
|
||||
/// <param name="extends"></param>
|
||||
/// <returns></returns>
|
||||
public static bool GetIsOut(this ParameterInfo extends)
|
||||
{
|
||||
if (extends == null)
|
||||
throw new ArgumentNullException("extends");
|
||||
|
||||
#if SIMPLSHARP
|
||||
return extends.Attributes.HasFlag(ParameterAttributes.Out);
|
||||
#else
|
||||
return extends.IsOut;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,7 @@
|
||||
<Compile Include="Extensions\DayOfWeekExtensions.cs" />
|
||||
<Compile Include="Extensions\ListExtensions.cs" />
|
||||
<Compile Include="Comparers\PredicateEqualityComparer.cs" />
|
||||
<Compile Include="Extensions\ParameterInfoExtensions.cs" />
|
||||
<Compile Include="Extensions\UriExtensions.cs" />
|
||||
<Compile Include="Extensions\UshortExtensions.cs" />
|
||||
<Compile Include="IcdUriBuilder.cs" />
|
||||
|
||||
Reference in New Issue
Block a user