ICSharpCode.NRefactory.CSharp.Resolver.CSharpResolver.CSharpPrimitiveCast C# (CSharp) Method

CSharpPrimitiveCast() private method

private CSharpPrimitiveCast ( TypeCode targetType, object input ) : object
targetType TypeCode
input object
return object
		internal object CSharpPrimitiveCast(TypeCode targetType, object input)
		{
			return Utils.CSharpPrimitiveCast.Cast(targetType, input, this.CheckForOverflow);
		}
		#endregion

Usage Example

Esempio n. 1
0
            public override object Invoke(CSharpResolver resolver, object lhs, object rhs)
            {
                if (lhs == null && rhs == null)
                {
                    return(!Negate);                    // ==: true; !=: false
                }
                if (lhs == null || rhs == null)
                {
                    return(Negate);                    // ==: false; !=: true
                }
                lhs = resolver.CSharpPrimitiveCast(Type, lhs);
                rhs = resolver.CSharpPrimitiveCast(Type, rhs);
                bool equal;

                if (Type == TypeCode.Single)
                {
                    equal = (float)lhs == (float)rhs;
                }
                else if (Type == TypeCode.Double)
                {
                    equal = (double)lhs == (double)rhs;
                }
                else
                {
                    equal = object.Equals(lhs, rhs);
                }
                return(equal ^ Negate);
            }
All Usage Examples Of ICSharpCode.NRefactory.CSharp.Resolver.CSharpResolver::CSharpPrimitiveCast
CSharpResolver