hi guys just wanted to ask what's the purpose of a this.GetType() in c#. I saw it in our professor's example. Also what's the purpose of that little maroon circle on the left part of my screenshot and why is every code beside it highlighted in maroon as well? Please answer my question, thank you guys and have a great day! dfdsgfdgbfdgfdghfcvbnvnvbnvbmnb

Recommended Answers

All 4 Replies

The red circles are break-points. if you run your app it will stop at those points. it allows you to step through your code to help locate the point at which your application throws an error (which is called debugging) you also use it to help understand how someone elses program works.

I've never had to use GetType() as of yet so i would be interested to know myself.

Hope this helps

how do I use breakpoints my friend? I mean what key should I press in order for me to be able to use breakpoints?

Running the program in Visual Studio will make it stop executing at the breakpoint(s). F9 sets/unsets a breakpoint, F5 runs, F10/F11 run single lines with one going into any function calls.

GetType is used to get the type (class) of the object. In this case, they are using GetType().Name to get "MeatLovers" as the kind of the pizza.

It depends on the programming environment you're using as to how you can use them. I use MS Visual Studios and there is a vertical grey bar to the left of the line numbers which you click and it inserts a break point on that position in your code. Once you have inserted the break point your code will run up to that point and stop to allow you to proceed line by line in order to see what is happening in the different lines of code.

It's priceless when you're trying to find bugs in a program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.