static int CompareTo(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes <int>(L, 2)) { System.Int32 obj = (System.Int32)ToLua.CheckObject(L, 1, typeof(System.Int32)); int arg0 = (int)LuaDLL.lua_tonumber(L, 2); int o = obj.CompareTo(arg0); LuaDLL.lua_pushinteger(L, o); ToLua.SetBack(L, 1, obj); return(1); } else if (count == 2 && TypeChecker.CheckTypes <object>(L, 2)) { System.Int32 obj = (System.Int32)ToLua.CheckObject(L, 1, typeof(System.Int32)); object arg0 = ToLua.ToVarObject(L, 2); int o = obj.CompareTo(arg0); LuaDLL.lua_pushinteger(L, o); ToLua.SetBack(L, 1, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: System.Int32.CompareTo")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void Print() { System.Int32 i = new System.Int32(); i = 23; Console.WriteLine(i.GetHashCode()); Console.WriteLine(i.GetType()); Console.WriteLine(i.GetTypeCode()); Console.WriteLine(i.ToString()); if (i.CompareTo(20) < 0) Console.WriteLine("{0} < 20", i); else if (i.CompareTo(20) == 0) Console.WriteLine("i equals 20"); else Console.WriteLine("i > 20"); Console.WriteLine(System.Int32.MinValue); Console.WriteLine(System.Int32.MaxValue); Console.WriteLine(System.Double.Epsilon); Console.WriteLine(System.Double.PositiveInfinity); Console.WriteLine(System.Double.NegativeInfinity); Console.WriteLine(System.Boolean.FalseString); Console.WriteLine(System.Boolean.TrueString); Console.WriteLine(System.Char.IsDigit('1')); Console.WriteLine(System.Char.IsLetter('9')); Console.WriteLine(System.Char.IsWhiteSpace("naynish chaughule", 7)); Console.WriteLine(System.Char.IsPunctuation('?')); //parsing double d = System.Double.Parse("90.35"); Console.WriteLine(d); System.Int64 longVar = Convert.ToInt64("43654703826562"); Console.WriteLine(longVar); Console.WriteLine(System.Guid.NewGuid()); System.DateTime dt = new DateTime(2012, 6, 04); Console.WriteLine(dt.ToLongDateString()); Console.WriteLine(DateTime.Now.ToLongTimeString()); Console.WriteLine(dt.DayOfWeek); Console.WriteLine(dt.AddMonths(5).ToLongDateString()); Console.WriteLine("{0} {1} {2}", dt.Date, dt.DayOfYear, dt.IsDaylightSavingTime()); TimeSpan ts = new TimeSpan(24, 30, 30); Console.WriteLine(dt.Add(ts).ToLongDateString()); Console.WriteLine(ts.Subtract(new TimeSpan(2,30, 45))); NumericsDemo(); WorkingWithStrings(); }
public virtual int CompareTo(System.Object o) { SampleComparable otherid = (SampleComparable)o; int i = String.CompareOrdinal(string_part, otherid.string_part); if (i == 0) { return(int_part.CompareTo(otherid.int_part)); } return(i); }
static StackObject* CompareTo_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Int32 value = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Int32 instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack); var result_of_this_method = instance_of_this_method.CompareTo(value); __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method; return __ret + 1; }
static StackObject *CompareTo_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Object value = (System.Object) typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Int32 instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack); var result_of_this_method = instance_of_this_method.CompareTo(value); __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method; return(__ret + 1); }
/// <summary> /// Compares two EdgeType objects by id /// </summary> /// <param name="obj">The object to compare with</param> /// <returns>a negative number if less, 0 if equal or else a positive number</returns> public int CompareTo(EdgeType obj) { return(m_typeId.CompareTo(obj.m_typeId)); }
public static System.Int32 of(System.Int32 left, System.Int32 right) { return(left.CompareTo(right) < 0 ? right : left); }
/// <summary> /// A T extension method that check if the value is between (exclusif) the minValue and maxValue. /// </summary> /// <param name="this">The @this to act on.</param> /// <param name="minValue">The minimum value.</param> /// <param name="maxValue">The maximum value.</param> /// <returns>true if the value is between the minValue and maxValue, otherwise false.</returns> /// ### /// <typeparam name="T">Generic type parameter.</typeparam> public static bool Between(this Int32 @this, Int32 minValue, Int32 maxValue) { return minValue.CompareTo(@this) == -1 && @this.CompareTo(maxValue) == -1; }
public int CompareTo(nint value) { return(v.CompareTo(value.v)); }
private static Int32 Compare(Int32 value1, String value2) { if (String.IsNullOrEmpty(value2)) return value1.CompareTo(0); if (Boolean.TrueString.Equals(value2, StringComparison.OrdinalIgnoreCase)) return value1 >= MinTrueInt ? 0 : -1; if (Boolean.FalseString.Equals(value2, StringComparison.OrdinalIgnoreCase)) return value1 >= MinTrueInt ? +1 : 0; Int32 parsedIntegerValue; if (Int32.TryParse(value2, out parsedIntegerValue)) return value1.CompareTo(parsedIntegerValue); Single parsedSingleValue; if (Single.TryParse(value2, out parsedSingleValue)) return ((Single)value1).CompareTo(parsedSingleValue); var stringLength = value2.Length; return value1.CompareTo(stringLength); }
private static void AssertComparison(Int32 value1, Int32 value2) { var expectedComparisonResult = value1.CompareTo(value2); AssertComparison(new DataObjectValue(value1), new DataObjectValue(value2), expectedComparisonResult); }