mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
feat: Cross-platform extension for determining if a ParameterInfo represents an "out" parameter
This commit is contained in:
parent
6fb290a0ab
commit
939f361b54
2 changed files with 30 additions and 0 deletions
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" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue