'How i can take multiple int inputs through string builder [closed]

How i can take multiple (int) inputs through string builder

my code is

class Solution
{
    public static void Main(string[] args)
    {
        StringBuilder s = new StringBuilder(int.Parse(Console.ReadLine()));
        int a = s[0];
        int b = s[1];
        
        Console.WriteLine(a+b);
    }
}


Solution 1:[1]

The constructor method that you are using has this description: Initializes a new instance of the StringBuilder class using the specified capacity.

It only means that space is pre-allocated, but that space is not initialized to anything, and there are no characters magically present in the string builder for you to use. Still that is what you are trying to do with the s[0] and s[1] code.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Peter B