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.
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#?
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...
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?
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...
- Modified
- 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...
- Modified
- 18 Apr at 02:18
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 ...
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.,...
- Modified
- 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...
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...
- Modified
- 6 Apr at 14:4
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?
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...
- Modified
- 13 Jul at 13:44
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....
- Modified
- 30 Aug at 16:6
Integer summing blues, short += short problem
Integer summing blues, short += short problem Program in C#:
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/...
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...
- Modified
- 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 ...
- Modified
- 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`.
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...
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...
- Modified
- 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...
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...
- Modified
- 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.
- Modified
- 18 Jul at 10:40