Example #1
0
#pragma warning restore CA1711
#pragma warning restore IDE0079

        /// <summary>
        /// Gets a value indicating whether the field is private.
        /// </summary>
        /// <param name="provider">The reflection introspection provider.</param>
        /// <param name="field">The field to retrieve visibility for.</param>
        /// <returns>true if the field is private; otherwise; false.</returns>
        public static bool IsPrivate(this IFieldInfoIntrospectionProvider provider, FieldInfo field) => (NotNull(provider).GetAttributes(field) & FieldAttributes.FieldAccessMask) == FieldAttributes.Private;
Example #2
0
#pragma warning disable IDE0079 // Remove unnecessary suppression.
#pragma warning disable CA1711  // Replace Impl suffix. (Mirror image of reflection APIs.)

        /// <summary>
        /// Gets a value indicating whether the field has the PinvokeImpl attribute.
        /// </summary>
        /// <param name="provider">The reflection introspection provider.</param>
        /// <param name="field">The field to inspect.</param>
        /// <returns>true if the field has the PinvokeImpl attribute set; otherwise, false.</returns>
        public static bool IsPinvokeImpl(this IFieldInfoIntrospectionProvider provider, FieldInfo field) => (NotNull(provider).GetAttributes(field) & FieldAttributes.PinvokeImpl) > FieldAttributes.PrivateScope;
Example #3
0
 /// <summary>
 /// Gets a value indicating whether the field has the NotSerialized attribute.
 /// </summary>
 /// <param name="provider">The reflection introspection provider.</param>
 /// <param name="field">The field to inspect.</param>
 /// <returns>true if the field has the NotSerialized attribute set; otherwise, false.</returns>
 public static bool IsNotSerialized(this IFieldInfoIntrospectionProvider provider, FieldInfo field) => (NotNull(provider).GetAttributes(field) & FieldAttributes.NotSerialized) > FieldAttributes.PrivateScope;
Example #4
0
 /// <summary>
 /// Gets a value indicating whether the field can only be set in the body of the constructor.
 /// </summary>
 /// <param name="provider">The reflection introspection provider.</param>
 /// <param name="field">The field to inspect.</param>
 /// <returns>true if the field has the InitOnly attribute set; otherwise, false.</returns>
 public static bool IsInitOnly(this IFieldInfoIntrospectionProvider provider, FieldInfo field) => (NotNull(provider).GetAttributes(field) & FieldAttributes.InitOnly) > FieldAttributes.PrivateScope;
Example #5
0
 /// <summary>
 /// Gets a value indicating whether the potential visibility of the specified <paramref name="field"/> is described by <see cref="FieldAttributes.FamORAssem" />; that is, the field can be accessed by derived classes wherever they are, and by classes in the same assembly.
 /// </summary>
 /// <param name="provider">The reflection introspection provider.</param>
 /// <param name="field">The field to retrieve visibility for.</param>
 /// <returns>true if the visibility of the specified <paramref name="field"/> is exactly described by <see cref="FieldAttributes.FamORAssem" />; otherwise, false.</returns>
 public static bool IsFamilyOrAssembly(this IFieldInfoIntrospectionProvider provider, FieldInfo field) => (NotNull(provider).GetAttributes(field) & FieldAttributes.FieldAccessMask) == FieldAttributes.FamORAssem;
Example #6
0
 /// <summary>
 /// Gets a value indicating whether the field has the SpecialName attribute.
 /// </summary>
 /// <param name="provider">The reflection introspection provider.</param>
 /// <param name="field">The field to inspect.</param>
 /// <returns>true if the field has the SpecialName attribute set; otherwise, false.</returns>
 public static bool IsSpecialName(this IFieldInfoIntrospectionProvider provider, FieldInfo field) => (NotNull(provider).GetAttributes(field) & FieldAttributes.SpecialName) > FieldAttributes.PrivateScope;