tagged [type-conversion]

How do you change the datatype of a column in SQL Server?

How do you change the datatype of a column in SQL Server? I am trying to change a column from a `varchar(50)` to a `nvarchar(200)`. What is the SQL command to alter this table?

Convert float to std::string in C++

Convert float to std::string in C++ I have a float value that needs to be put into a `std::string`. How do I convert from float to string?

16 Nov at 16:11

How could I convert data from string to long in c#

How could I convert data from string to long in c# How could i convert data from string to long in C#? I have data now i want it in

How to convert a double to long without casting?

How to convert a double to long without casting? What is the best way to convert a double to a long without casting? For example:

21 Sep at 20:39

What is the difference between casting and conversion?

What is the difference between casting and conversion? Eric Lippert's comments in [this question](https://stackoverflow.com/questions/3166349/what-is-the-type-in-typeobjectname-var) have left me thoro...

23 May at 12:34

I need to convert an XML string into an XmlElement

I need to convert an XML string into an XmlElement I'm looking for the simplest way to convert a string containing valid XML into an `XmlElement` object in C#. How can you turn this into an `XmlElemen...

31 Jul at 21:45

How does the CLR know the type of a boxed object?

How does the CLR know the type of a boxed object? When a value type is boxed, it is placed inside an reference object. So what causes the invalid cast exception here?

16 Apr at 09:5

Convert Enum to List

Convert Enum to List Say i have the following Enum Values I would like to convert them to list of values (i.e) `{ CSharp,Java,VB}.` How to convert them to a list of values?

31 May at 06:0

C# Convert Char to Byte (Hex representation)

C# Convert Char to Byte (Hex representation) This seems to be an easy problem but i can't figure out. I need to convert this character in byte(hex representation), but if i use ``` byte b = Convert.To...

31 Mar at 21:25

What is better: int.TryParse or try { int.Parse() } catch

What is better: int.TryParse or try { int.Parse() } catch I know.. I know... Performance is not the main concern here, but just for curiosity, what is better? OR

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...

C# does not let me sum two shorts to a short

C# does not let me sum two shorts to a short I have a code: And it does not compile, saynig cannot convert 'int' to 'short'. I am maybe really tired today but I cannot see the issue!

7 Aug at 20:26

how to convert a string to a bool

how to convert a string to a bool I have a `string` that can be either "0" or "1", and it is guaranteed that it won't be anything else. So the question is: what's the best, simplest and most elegant w...

9 Aug at 18:32

Converting String To Float in C#

Converting String To Float in C# I am converting a string like "41.00027357629127", and I am using; or These methods return . When I convert to float I want "41.00027357629127". This string should be ...

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...

How to convert byte array to image file?

How to convert byte array to image file? I have browsed and uploaded a png/jpg file in my MVC web app. I have stored this file as byte[] in my database. Now I want to read and convert the byte[] to or...

22 May at 19:4

How to convert Decimal to Double in C#?

How to convert Decimal to Double in C#? I want to assign the decimal variable "trans" to the double variable "this.Opacity". When I build the app it gives the following error: > Cannot implicitly conv...

Converting from byte to int in Java

Converting from byte to int in Java I have generated a secure random number, and put its value into a byte. Here is my code. But I am getting an error :

19 Dec at 11:27

TryParse create inline parameter?

TryParse create inline parameter? Is there any way in C# to create a variable inline? Something like this: Don´t you think that this is more useful than creating a variable outside and then never use ...

4 Nov at 14:35

Why does "decimal.TryParse()" always return 0 for the input string "-1" in the below code?

Why does "decimal.TryParse()" always return 0 for the input string "-1" in the below code? The below code should return the -1 decimal value but it's returning 0. Is there something I am doing wrong? ...

10 May at 13:4

How can I convert a string with dot and comma into a float in Python

How can I convert a string with dot and comma into a float in Python How can I convert a string like `123,456.908` to float `123456.908` in Python? --- `int`[How to convert a string to a number if it ...

3 Oct at 18:6

Create ArrayList from array

Create ArrayList from array Given an array of type `Element[]`: How do I convert this array into an object of type [ArrayList](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Ar...

17 Jul at 00:14

How to parse string to decimal with currency symbol?

How to parse string to decimal with currency symbol? I have no idea why this is not working:

How do I convert a string to a number in PHP?

How do I convert a string to a number in PHP? I want to convert these types of values, `'3'`, `'2.34'`, `'0.234343'`, etc. to a number. In JavaScript we can use `Number()`, but is there any similar me...

24 Jun at 19:42

Convert byte[] to sbyte[]

Convert byte[] to sbyte[] I tried to convert an Array from `byte[]` to `sbyte[]`. Here is my sample Array: I already tried this: But it doesn't work. There is no value in the array after this operatio...

10 Sep at 07:42