Rather simple:
Key = i.ToString("D2");
D
stands for “decimal number”, 2
for the number of digits to print.
More Related Contents:
- Add separator to string at every N characters?
- Format a string into columns
- String.Format – how it works and how to implement custom formatstrings
- Is there a “String.Format” that can accept named input parameters instead of index placeholders? [duplicate]
- Display Float as String with at Least 1 Decimal Place
- Using variables inside strings
- What’s wrong with my function? C# [closed]
- How to trim after 1 letter from space C#? [closed]
- How do I parse a string with a decimal point to a double?
- Splitting a string into chunks of a certain size
- Color different parts of a RichTextBox string
- How can I String.Format a TimeSpan object with a custom format in .NET?
- Convert int to string?
- Convert string to DateTime in c#
- String Concatenation using ‘+’ operator
- Difference between string and StringBuilder in C#
- Add zero-padding to a string
- Why is there no Char.Empty like String.Empty?
- How do I split a string by strings and include the delimiters using .NET?
- How do I truncate a .NET string?
- Connection string with relative path to the database file
- C# Version Of SQL LIKE
- Compare string similarity
- Java equivalent of C#’s verbatim strings with @
- C# date formatting is losing slash separators
- string.Empty vs null.Which one do you use?
- String.Format an integer to use a thousands separator without decimal places or leading 0 for small integers
- ReferenceEquals working wrong with strings
- Get values between curly braces c#
- splitting a string based on multiple char delimiters