From the course: .NET Essentials: Working with LINQ

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Explore the program editor

Explore the program editor - .NET Tutorial

From the course: .NET Essentials: Working with LINQ

Explore the program editor

- [Instructor] My third choice in this drop-down is the C-Sharp Program. When I enter that, you'll see that LINQPad write some code for me. And it's created a void main. Now, the idea is I write my code in void main, but I can also define other classes or other methods in the lower half of this window. And what'll happen is LINQPad will compile my classes, and methods, and make them available. And then it will run any code that's in main. Here's what that looks like with a sample. Here, I've got this GetMagicNumber, which returns 42. I then call some code in main where I declare a variable that's resulting from calling GetMagicNumber and then adding 200. And then I'm outputting the results using the dump method. In this case, I didn't create a class. So you can think of this GetMagicNumber as being in the same scope as main or inside the same class. Let's change that a little bit. I will add a public class here, call this…

Contents