C# Tutorials out there?

Hey guys. I am learning C# and I know it pretty well by now. But I don't know a few things like....


- Whats the difference between a struct and inheriting?

- What's the use of a finally block in a try(-catch) statement?

- What does the keyword "abstract" mean?

- What does the keyword "virtual" mean?


Now before you go and give me simplistic explanations, or yell at me for not reading the documentation (That thing is annoying to understand) know that I have a pretty good understanding of C#'s syntax, so I don't need to be talked at like a new programmer.



I know how you feel, sometimes documentation can be frustrating.  It can be too light or too dense and not really help you understand what you need to.

I am not sure I understand your first question, the difference between a struct and inheriting.  You can sort of think of a struct as a light weight non-extendable class, but with differences.  In C# a struct can implement an interface, so you can use structs and still support the design contract, limited form of “inheritance.”  According to Microsoft’s documentation, you should use structs to define small, lightweight storage datatypes that are immutable.  Though, within your application, you should always try to make as many of objects as possible immutable.  Immutable objects are by definition thread safe, and making objects immutable helps reduce errors within your code.

The finally block is used to guarantee that code defined within it will always be executed even if an exception occurs. It is usually used for cleaning up resources or releasing locks, but inside a finally block, you can put any code you always want to be executed regardless of if an exception occurs.

In C#, any method marked as abstract MUST be overridden in an implementation class.  Any method marked as virtual can be overridden, but don’t have to be.  You can accept the default implementation, or override it with your own

Thanks for your help, I think I'm understanding it better :)