tagged [int]

Convert datarow to int

Convert datarow to int I have a datarow, but how can i convert it to an int ? I tried this, but it doesn't work.

2 Mar at 14:13

Why int can't be null? How does nullable int (int?) work in C#?

Why int can't be null? How does nullable int (int?) work in C#? I am new to C# and just learned that objects can be null in C# but `int` can't. Also how does nullable int (`int?`) work in C#?

10 Jul at 07:9

Better way to convert an int to a boolean

Better way to convert an int to a boolean The input `int` value only consist out of 1 or 0. I can solve the problem by writing a `if else` statement. Isn't there a way to cast the `int` into a `boolea...

15 Jul at 12:50

What's the best way to compare Double and Int?

What's the best way to compare Double and Int? The following code in C# doesn't work: So, the question: what's the best way to compare Double and Int?

26 Mar at 18:46

C# int, Int32 and enums

C# int, Int32 and enums If `int` is synonymous to `Int32` why does ...not compile? Where as will, even though hovering the cursor over the int word will display struct System.Int32?

5 Mar at 08:40

What is the int.MaxValue on a 64-bit PC?

What is the int.MaxValue on a 64-bit PC? This line gives me the answer of `2,147,483,647` as I have a 32-bit PC. Will the answer be same on a 64-bit PC?

16 Aug at 01:58

Is int? thread safe?

Is int? thread safe? I know that in .Net all 32-bit types (e.g, `int`, `bool`, etc) are thread safe. That is, there won't be a partial write (according to the specifications). But, does the same apply...

14 Jul at 14:47

Count leading zeroes in an Int32

Count leading zeroes in an Int32 How do I count the leading zeroes in an `Int32`? So what I want to do is write a function which returns 30 if my input is 2, because in binary I have `000...0000000000...

Why does Decimal.Divide(int, int) work, but not (int / int)?

Why does Decimal.Divide(int, int) work, but not (int / int)? How come dividing two 32 bit int numbers as ( int / int ) returns to me `0`, but if I use `Decimal.Divide()` I get the correct answer? I'm ...

3 Mar at 16:25

How to check whether input value is integer or float?

How to check whether input value is integer or float? How to check whether input value is integer or float? Suppose 312/100=3.12 Here i need check whether 3.12 is a float value or integer value, i.e.,...

4 Aug at 22:12

Convert a long to two int for the purpose of reconstruction

Convert a long to two int for the purpose of reconstruction I need to pass a parameter as two int parameters to a Telerik Report since it cannot accept Long parameters. What is the easiest way to spli...

2 Jun at 19:58

Int to Decimal Conversion - Insert decimal point at specified location

Int to Decimal Conversion - Insert decimal point at specified location I have the following int 7122960 I need to convert it to 71229.60 Any ideas on how to convert the int into a decimal and insert t...

WPF Textbox accept INT but not NULLABLE INT?

WPF Textbox accept INT but not NULLABLE INT? Model XAML Once user try to or the value in this `textbox`, a message `Value '' cannot be converted`. May I know what's wrong with it?

15 Feb at 04:0

C convert floating point to int

C convert floating point to int I'm using (not C++). I need to convert a float number into an `int`. I do not want to round to the the nearest number, I simply want to eliminate what is after the inte...

Convert unsigned int to signed int C

Convert unsigned int to signed int C I am trying to convert `65529` from an `unsigned int` to a signed `int`. I tried doing a cast like this: But `y` is still returning 65529 when it should return -7....

30 Aug at 16:6

Integer summing blues, short += short problem

Integer summing blues, short += short problem Program in C#:

12 Dec at 00:1

Java Array Sort descending?

Java Array Sort descending? Is there any EASY way to sort an array in descending order like how they have a sort in ascending order in the [Arrays class](http://docs.oracle.com/javase/7/docs/api/java/...

26 Dec at 04:1

Rounding integer division (instead of truncating)

Rounding integer division (instead of truncating) I was curious to know how I can round a number to the nearest whole number. For instance, if I had: which would be 14.75 if calculated in floating poi...

19 Mar at 02:12

How to do Integer model validation in asp.net mvc 2

How to do Integer model validation in asp.net mvc 2 I have a registration form and the user must enter the square footage of their house. I would like this value to be only an integer. Is there a way ...

24 Feb at 15:35

Converting a double to an int in C#

Converting a double to an int in C# In our code we have a double that we need to convert to an int. Can anyone explain me why `i1 != i2`? The result that I get is that: `i1 = 9` and `i2 = 8`.

25 May at 12:15

Convert string to int and test success in C#

Convert string to int and test success in C# How can you check whether a is to an Let's say we have data like "House", "50", "Dog", "45.99", I want to know whether I should just use the or use the par...

31 Oct at 21:6

C# Converting a string containing a floating point to an integer

C# Converting a string containing a floating point to an integer What is the best way to take a string which can be empty or contain "1.2" for example, and convert it to an integer? `int.TryParse` fai...

21 Feb at 19:4

Increment a Integer's int value?

Increment a Integer's int value? How do I increment a Integer's value in Java? I know I can get the value with intValue, and I can set it with new Integer(int i). does not seem to work. Note: PlayerID...

28 Sep at 16:57

Checking if float is an integer

Checking if float is an integer How can I check if a `float` variable contains an integer value? So far, I've been using: But I wonder if there is a better solution, or if this one has any (or many) d...

9 May at 19:59

Convert Int to String in Swift

Convert Int to String in Swift I'm trying to work out how to cast an `Int` into a `String` in Swift. I figure out a workaround, using `NSNumber` but I'd love to figure out how to do it all in Swift.

18 Jul at 10:40