Example #1
0
        /// <summary>
        /// Initializes a new CSharp convert binder.
        /// </summary>
        ///
        /// <returns>
        /// Returns a new CSharp convert binder.
        /// </returns>
        /// <param name="flags">The flags with which to initialize the binder.</param><param name="type">The type to convert to.</param><param name="context">The <see cref="T:System.Type"/> that indicates where this operation is used.</param>
        public static CallSiteBinder Convert(CSharpBinderFlags flags, Type type, Type context)
        {
            CSharpConversionKind conversionKind = (flags & CSharpBinderFlags.ConvertExplicit) != CSharpBinderFlags.None ? CSharpConversionKind.ExplicitConversion : ((flags & CSharpBinderFlags.ConvertArrayIndex) != CSharpBinderFlags.None ? CSharpConversionKind.ArrayCreationConversion : CSharpConversionKind.ImplicitConversion);
            bool isChecked = (flags & CSharpBinderFlags.CheckedContext) != CSharpBinderFlags.None;

            return((CallSiteBinder) new CSharpConvertBinder(type, conversionKind, isChecked, context));
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CSharpConvertBinder" />.
 /// </summary>
 /// <param name="type">The type to convert to.</param>
 /// <param name="conversionKind">The kind of conversion for this operation.</param>
 /// <param name="isChecked">True if the operation is defined in a checked context; otherwise, false.</param>
 /// <param name="callingContext">The <see cref="Type"/> that indicates where this operation is defined.</param>
 public CSharpConvertBinder(
     Type type,
     CSharpConversionKind conversionKind,
     bool isChecked,
     Type callingContext) :
     base(type, conversionKind == CSharpConversionKind.ExplicitConversion)
 {
     ConversionKind = conversionKind;
     _binder        = new RuntimeBinder(callingContext, isChecked);
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CSharpConvertBinder" />.
 /// </summary>
 /// <param name="type">The type to convert to.</param>
 /// <param name="conversionKind">The kind of conversion for this operation.</param>
 /// <param name="isChecked">True if the operation is defined in a checked context; otherwise, false.</param>
 /// <param name="callingContext">The <see cref="Type"/> that indicates where this operation is defined.</param>
 public CSharpConvertBinder(
     Type type,
     CSharpConversionKind conversionKind,
     bool isChecked,
     Type callingContext) :
     base(type, conversionKind == CSharpConversionKind.ExplicitConversion)
 {
     ConversionKind = conversionKind;
     IsChecked      = isChecked;
     CallingContext = callingContext;
     _binder        = RuntimeBinder.GetInstance();
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CSharpConvertBinder" />.
 /// </summary>
 /// <param name="type">The type to convert to.</param>
 /// <param name="conversionKind">The kind of conversion for this operation.</param>
 /// <param name="isChecked">True if the operation is defined in a checked context; otherwise false.</param>        
 public CSharpConvertBinder(
     Type type,
     CSharpConversionKind conversionKind,
     bool isChecked,
     Type callingContext) :
     base(type, conversionKind == CSharpConversionKind.ExplicitConversion)
 {
     ConversionKind = conversionKind;
     IsChecked = isChecked;
     CallingContext = callingContext;
     _binder = RuntimeBinder.GetInstance();
 }
Example #5
0
        //////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new CSharp convert binder.
        /// </summary>
        /// <param name="flags">The flags with which to initialize the binder.</param>
        /// <param name="type">The type to convert to.</param>
        /// <param name="context">The <see cref="System.Type"/> that indicates where this operation is used.</param>
        /// <returns>Returns a new CSharp convert binder.</returns>
        public static CallSiteBinder Convert(
            CSharpBinderFlags flags,
            Type type,
            Type?context)
        {
            CSharpConversionKind conversionKind =
                ((flags & CSharpBinderFlags.ConvertExplicit) != 0) ?
                CSharpConversionKind.ExplicitConversion :
                ((flags & CSharpBinderFlags.ConvertArrayIndex) != 0) ?
                CSharpConversionKind.ArrayCreationConversion :
                CSharpConversionKind.ImplicitConversion;
            bool isChecked = (flags & CSharpBinderFlags.CheckedContext) != 0;

            return(new CSharpConvertBinder(type, conversionKind, isChecked, context).TryGetExisting());
        }
Example #6
0
 public CSharpConvertBinder(Type type, CSharpConversionKind conversionKind, bool isChecked)
     : base(type, conversionKind == CSharpConversionKind.ExplicitConversion)
 {
     this.is_checked = isChecked;
 }
		public CSharpConvertBinder (Type type, CSharpConversionKind conversionKind, bool isChecked)
			: base (type, conversionKind == CSharpConversionKind.ExplicitConversion)
		{
			this.is_checked = isChecked;
		}