About 10,400 results
Open links in new tab
  1. c# - Best way to cast/convert number to string - Stack Overflow

    May 5, 2014 · If you have a string which contains an int value, you parse (or tryparse) it. string myIntStr = "5"; int myInt = int.Parse(myIntStr); If you don't know if the boxed type is the assummed type you use is and as. object assumedMyType = new MyType(); MyType myType = assumedMyType as MyType;

  2. Convert.ToString Method (System) | Microsoft Learn

    Converts the value of a 16-bit signed integer to its equivalent string representation in a specified base. Converts the value of the specified DateTime to its equivalent string representation, using the specified culture-specific formatting information.

  3. c# - Convert int to string? - Stack Overflow

    Jun 21, 2010 · .ToString() is the most efficient way to do the conversion. All of the other methods presented here will eventually call .ToString() anyway. Just in case you want the binary representation and you're still drunk from last night's party: StringBuilder builder = new StringBuilder(sizeof(byte) * 8);

  4. How do I convert an Int to a String in C# without using ToString ...

    Jul 10, 2013 · Convert the following int argument into a string without using any native toString functionality. public string integerToString(int integerPassedIn){ //Your code here } Since everything in...

  5. How to Convert Int to String in C# - Code Maze

    Feb 20, 2022 · Using Int32.ToString Method to Convert Int to String. Let’s first create a console application, and define an int variable with a value of 3: var luckyNumber = 3; Next, let’s use this variable in our examples to convert int to string using the different methods and display it on the console window.

  6. C# int to string conversion - converting integers to strings in C#

    Jan 22, 2024 · C# int to String tutorial shows how to convert integers to strings. There are several ways to perform int to String conversion in C#. We can use string concatenation, string formatting, string building, and use built-in conversion methods.

  7. Different Ways for Integer to String Conversions in C#

    The easiest way to convert an integer to a string in C# is using the ToString() method. Let us see an example −. int a = 100; string str = a.ToString(); Another way is to use Convert.ToString(); b = 50; string str2 = Convert.ToString(b); Console.WriteLine(str2); The following is the example showing the different ways to convert integer to string.

  8. How to Convert int to String with Sample Code - EDUCBA

    Apr 13, 2023 · Converting int to string in C# is used to convert non-decimal numbers to string character. This can be done by using int to string conversion, int to string with Int32.ToString(), int to string with string concatenation, int to string with StringBuilder, int to string with Convert.ToString() and int to string with string.Format().

  9. How to Convert Int to String in C# - Delft Stack

    Feb 2, 2024 · This C# int to string how-to article shows different methods to convert an integer to string in C#. It introduces methods like ToString method, Convert.ToString method, string formatting, and string concatenation method.

  10. C# - Convert int to string | System Out Of Memory

    Calling .ToString() directly is the most efficient way to get from an int to string. C# int to string examples int ageNum = 23; string age = ageNum.ToString(); string age = Convert.ToString(ageNum); string age = string.Format("{0}", i); string age = $"{ageNum}"; string age = "" + ageNum; string age = string.Empty + ageNum;

  11. Some results have been removed