How can I create a StackOverflowException with minimal lines of code?
StackOverflowException
Like this:
A() { new A(); }
throw new StackOverflowException();
Cheating, I know ... :)
Not the shortest, but the funniest :)
public static bool IsNotEmpty(string value) { return !IsEmpty(value); } public static bool IsEmpty(string value) { return !IsNotEmpty(value); } public static void Main() { bool empty = IsEmpty("Hello World"); }
public static void Main() { Main(); }
I always use this code (because it's harder to detect): - (
private int _num; public int Num { get { return Num; } set { _num = value; } }
in pseudo code
func(): call func()
public int Method(int i) { return i + Method(i + 1); }
I think this should work. In general, any recursion that does not end there.
Run this code (recursion):
f () { f(); }
Source: https://habr.com/ru/post/650245/More articles:"Command not found" when trying to integer equality in bash - bashto configure nginx in passenger 3.0.2 separately - ruby-on-railsConvert cron expression to pretty description lines? Is there a library for JAVA and Objective-C? - javaUsing qUnit to test javascript - javascriptbash, find, exec and echo - command-lineProblem with two-way binding settings - c #Python Enum class (with tostring fromstring) - pythonSQL Determining the size of a query result - sqlOpen source open source JMX client? - javaWhy is the code snippet shown in VB more than in C #? - c #All Articles