Question:
How to solve the system StackOverflow Exception?

Solution:

Please verify that your code has no proper base case (exit condition) and is recursive. You are limited to a certain depth of recursion. 


All you need to do is create a string that begins with TEK and has, in your case, 15 digits added to it.


The following creates a string containing 15 random digits:

public string CreateRandomCode(int codeCount = 15)

{

 string allChar = "0,1,2,3,4,5,6,7,8,9";   

 string[] allCharArray = allChar.Split(',');

 string randomCode = "";

 Random rand = new Random();

 for (int i = 0; i < codeCount; i++)

 {

  randomCode += allCharArray[rand.Next(0, allCharArray.Length)]; 

 }

 return randomCode;

}



Suggested blogs:

>>How can I specify a monkey-patched class in the typescript definitions file in JavaScript?

>>How to merge an object into Array of an objects with the same key in JavaScript?

>>How to make one JavaScript event wait for another to trigger?

>>How to manipulate Array object in JavaScript?

>>How to do light and dark mode in a website using HTML and JavaScript?

>>How to fix mouseover event glitch in JavaScript?

>>How to use querySelectorAll()" with multiple conditions in JavaScript?

Ritu Singh

Ritu Singh

Submit
0 Answers