/// <summary>
 /// Initializes a new instance of the <see cref="GenericArgument"/> struct.
 /// </summary>
 /// <param name="location">The location.</param>
 /// <param name="position">The position.</param>
 /// <param name="type">The type.</param>
 /// <remarks></remarks>
 public GenericArgument(GenericArgumentLocation location, int position, [NotNull] Type type)
     : this()
 {
     if (type == null) throw new ArgumentNullException("type");
     Location = location;
     Position = position;
     Type = type;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GenericArgument"/> struct.
 /// </summary>
 /// <param name="location">The location.</param>
 /// <param name="position">The position.</param>
 /// <param name="type">The type.</param>
 /// <remarks></remarks>
 public GenericArgument(GenericArgumentLocation location, int position, [NotNull] Type type)
     : this()
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     Location = location;
     Position = position;
     Type     = type;
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="name">The name.</param>
 /// <param name="location">The location.</param>
 /// <param name="position">The position.</param>
 /// <param name="isByReference">if set to <see langword="true"/> [is by reference].</param>
 /// <param name="isPointer">if set to <see langword="true"/> [is pointer].</param>
 /// <remarks></remarks>
 private TypeSearch(
     Type type   = null,
     string name = null,
     GenericArgumentLocation location = GenericArgumentLocation.None,
     int position       = -1,
     bool isByReference = false,
     bool isPointer     = false)
 {
     Type = type;
     GenericArgumentName     = name;
     GenericArgumentLocation = location;
     GenericArgumentPosition = position;
     IsByReference           = isByReference;
     IsPointer = isPointer;
 }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TypeSearch"/> class.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <remarks></remarks>
        public TypeSearch([NotNull] Type type)
            : this(type, isByReference : type.IsByRef, isPointer : type.IsPointer)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            if (type.IsGenericParameter)
            {
                GenericArgumentLocation = type.DeclaringMethod != null
                    ? GenericArgumentLocation.Signature
                    : GenericArgumentLocation.Type;
                GenericArgumentPosition = type.GenericParameterPosition;
                GenericArgumentName     = type.Name;
            }
        }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TypeSearch"/> class.
        /// </summary>
        /// <param name="location">The location.</param>
        /// <param name="position">The position.</param>
        /// <param name="isByReference">if set to <see langword="true"/> is by reference.</param>
        /// <param name="isPointer">if set to <see langword="true"/> is pointer.</param>
        /// <remarks></remarks>
        public TypeSearch(
            GenericArgumentLocation location,
            int position,
            bool isByReference = false,
            bool isPointer     = false)
            : this(null, null, location, position, isByReference, isPointer)
        {
            // Validate location
            switch (GenericArgumentLocation)
            {
            case GenericArgumentLocation.Signature:
            case GenericArgumentLocation.Type:
                break;

            default:
                throw new ArgumentOutOfRangeException("location");
            }
        }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TypeSearch"/> class.
 /// </summary>
 /// <param name="location">The location.</param>
 /// <param name="name">The name.</param>
 /// <param name="isByReference">if set to <see langword="true"/> is by reference.</param>
 /// <param name="isPointer">if set to <see langword="true"/> is pointer.</param>
 /// <remarks></remarks>
 public TypeSearch(
     GenericArgumentLocation location,
     [NotNull] string name,
     bool isByReference = false,
     bool isPointer = false)
     : this(null, name, location, -1, isByReference, isPointer)
 {
     // Validate location
     switch (GenericArgumentLocation)
     {
         case GenericArgumentLocation.Signature:
         case GenericArgumentLocation.Type:
         case GenericArgumentLocation.Any:
             break;
         default:
             throw new ArgumentOutOfRangeException("location");
     }
 }
Example #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TypeSearch"/> class.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <remarks></remarks>
        public TypeSearch([NotNull] Type type)
            : this(type, isByReference: type.IsByRef, isPointer: type.IsPointer)
        {
            if (type == null) throw new ArgumentNullException("type");

            if (type.IsGenericParameter)
            {
                GenericArgumentLocation = type.DeclaringMethod != null
                    ? GenericArgumentLocation.Signature
                    : GenericArgumentLocation.Type;
                GenericArgumentPosition = type.GenericParameterPosition;
                GenericArgumentName = type.Name;
            }
        }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="name">The name.</param>
 /// <param name="location">The location.</param>
 /// <param name="position">The position.</param>
 /// <param name="isByReference">if set to <see langword="true"/> [is by reference].</param>
 /// <param name="isPointer">if set to <see langword="true"/> [is pointer].</param>
 /// <remarks></remarks>
 private TypeSearch(
     Type type = null,
     string name = null,
     GenericArgumentLocation location = GenericArgumentLocation.None,
     int position = -1,
     bool isByReference = false,
     bool isPointer = false)
 {
     Type = type;
     GenericArgumentName = name;
     GenericArgumentLocation = location;
     GenericArgumentPosition = position;
     IsByReference = isByReference;
     IsPointer = isPointer;
 }