forked from FakeItEasy/FakeItEasy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request FakeItEasy#1393 from FakeItEasy/release/4.7.1
Release 4.7.1
- Loading branch information
Showing
7 changed files
with
92 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
namespace FakeItEasy | ||
{ | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
/// <summary> | ||
/// Provides extension methods for <see cref="ParameterInfo"/>. | ||
/// </summary> | ||
internal static class ParameterInfoExtensions | ||
{ | ||
private const string IsReadOnlyAttributeFullName = "System.Runtime.CompilerServices.IsReadOnlyAttribute"; | ||
|
||
public static bool IsOutOrRef(this ParameterInfo parameterInfo) | ||
{ | ||
if (!parameterInfo.ParameterType.IsByRef) | ||
{ | ||
return false; | ||
} | ||
|
||
#if FEATURE_PARAMETERINFO_CUSTOMATTRIBUTES_PROPERTY | ||
var parameterAttributes = parameterInfo.CustomAttributes; | ||
return parameterAttributes == null || | ||
parameterAttributes.All(customAttributeData => customAttributeData.AttributeType.FullName != IsReadOnlyAttributeFullName); | ||
#else | ||
var parameterAttributes = parameterInfo.GetCustomAttributesData(); | ||
return parameterAttributes == null || | ||
parameterAttributes.All(customAttributeData => customAttributeData.Constructor.DeclaringType?.FullName != IsReadOnlyAttributeFullName); | ||
#endif | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters