Click here to Skip to main content
15,886,823 members
Articles / Programming Languages / C#

.NET Framework Basics - Preparation for exam 70-536

Rate me:
Please Sign up or sign in to vote.
4.89/5 (84 votes)
11 Mar 2010CC (ASA 2.5)2 min read 101.7K   1.7K   173   63
Base practice code for those preparing the exam 70-536 or learning the .NET framework basis

Introduction

This article presents a code example with the usage of the basic .NET Framework classes according to the first certification exam 70-536.

When studying for that exam, I found it useful to have all the involved code in one simple file/project for easy debugging. That's why I created this WinForms application with 21 Tabs plenty of examples.

Image 1

For example, here you can see the tab that allows you to play with the System.Drawing library to draw strings.

Image 2

Using the Code

If you are planning to take the first exam of the .NET Framework or just learn the usage of the base classes, this is the plan that I suggest:

  1. Read the official MCTS Self-Paced Training Kit.
  2. Get at least one of the official recommended test engines and exams suggested by Microsoft.
  3. Use the code provided in this article to debug each feature and play with the basic classes. Complete any TODO in the code.
  4. You can also copy the entire code to a Word document and print it in color for easy reference and for studying when you are commuting to the office. I estimate it takes less than 50 pages/almost 3000 lines of code. This will help you remember the classes and the common usage.
  5. You can print the code and the diagram shown below and place it in a wall like in your office box.
  6. Find study partners! Engage people in your software factory/office to certify together and meet to discuss. Remember the Latin proverb “By learning you will teach, by teaching you will learn”.
  7. Find in CodeProject other examples of the missing sections. There are fantastic regular expressions and COM interoperability articles that you should check.

Bonus

I included a PDF with a diagram I made some time ago showing the basic concepts related to Classes, Interfaces and Structs. It is based in the public C# 2.0 language definition. You can print it as is or you can convert it to Word format with any of the utilities available in the network for that purpose or copy the content to the clipboard.

Here I show you just a part of the diagram:

Image 3

As you will see, the diagram shows only the most relevant particularities of the language like for example "the interface can inherit multiple base-interfaces".

The recommendation is that you play with Visual Studio one more time trying to apply and challenge each "cell" on the diagram and think why that is the way it is.

Points of Interest

You need to understand that the code provided in this article is by no means a replacement for any other official preparation material. This is just a companion "easy to debug, easy to print".

License

This article, along with any associated source code and files, is licensed under The Creative Commons Attribution-ShareAlike 2.5 License


Written By
Software Developer (Senior) none
Canada Canada
Fabian walks for the streets of Montreal listening to his iPod

Comments and Discussions

 
GeneralHi Companion Pin
Anil Srivastava11-Apr-10 20:48
Anil Srivastava11-Apr-10 20:48 
GeneralRe: Hi Companion Pin
fabianse13-Apr-10 15:43
professionalfabianse13-Apr-10 15:43 
GeneralGreat one Pin
Brij11-Apr-10 19:14
mentorBrij11-Apr-10 19:14 
GeneralRe: Great one Pin
fabianse13-Apr-10 15:41
professionalfabianse13-Apr-10 15:41 
GeneralGreat article Pin
Gaurav Dudeja India11-Apr-10 18:53
Gaurav Dudeja India11-Apr-10 18:53 
GeneralRe: Great article Pin
fabianse11-Apr-10 18:55
professionalfabianse11-Apr-10 18:55 
Questionabout structs..... [modified] Pin
musicm12218-Mar-10 4:54
professionalmusicm12218-Mar-10 4:54 
AnswerRe: about structs..... [modified] Pin
fabianse19-Mar-10 7:50
professionalfabianse19-Mar-10 7:50 
Thanks, that's a good point and it will require more attention in future versions of the diagram.

Look at the ECMA definition of C# that you can download here:
http://www.ecma-international.org/publications/standards/Ecma-334.htm[^]

This is an extract from page 43, "8.8 Structs".
--- ECMA TEXT ---
The program below creates and initializes an array of 100 points.
With Point implemented as a class, 101 separate objects are instantiated—one for the array and one each
for the 100 elements.

C#
class Point
{
  public int x, y;
  public Point(int x, int y) {
    this.x = x;
    this.y = y;
  }
}
class Test
{
  static void Main() {
    Point[] points = new Point[100];
    for (int i = 0; i < 100; i++)
    points[i] = new Point(i, i*i);
  }
}

If Point is instead implemented as a struct, as in
C#
struct Point
{
  public int x, y;
  public Point(int x, int y) {
    this.x = x;
    this.y = y;
  }
}


only one object is instantiated—the one for the array. The Point instances are allocated in-line within the
array.

--- END OF ECMA TEXT ---

As you could read it says "only one object is instantiated" so that's a case when even the use of the New operator over a struct does not always imply "instantiation".

As you mentioned, I think the diagram can be modified on that aspect perhaps splitting the column between "instantiation" and "in-line allocation" and say that structs are instantiated only with the first call to the new operator over the type or the containing array or class, and they are just "copied" the next times Hmmm | :|

There are some nice articles out there in the web that explain the different IL generated in the different scenarios with classes and structs. Like this one:
http://stackoverflow.com/questions/203695/structure-vs-class-in-c[^]

For the sake of the diagram and learning the basics for the exam 70-536, the important thing to keep in mind is that structs are passed by value as method parameters and they are copied from one to another when using the assignment operator.

Does it make sense?
modified on Saturday, March 20, 2010 8:41 AM

GeneralThank you Pin
Ratish Philip18-Mar-10 2:27
Ratish Philip18-Mar-10 2:27 
GeneralRe: Thank you Pin
fabianse20-Mar-10 3:07
professionalfabianse20-Mar-10 3:07 
GeneralWow Pin
Dmitri Nеstеruk16-Mar-10 6:12
Dmitri Nеstеruk16-Mar-10 6:12 
GeneralRe: Wow Pin
fabianse17-Mar-10 15:07
professionalfabianse17-Mar-10 15:07 
GeneralWonderful Pin
sheniss15-Mar-10 17:52
sheniss15-Mar-10 17:52 
GeneralRe: Wonderful Pin
fabianse17-Mar-10 15:05
professionalfabianse17-Mar-10 15:05 
Generalthanks Pin
harun_san12-Mar-10 3:23
harun_san12-Mar-10 3:23 
GeneralRe: thanks Pin
fabianse14-Mar-10 13:28
professionalfabianse14-Mar-10 13:28 
GeneralIts really amazing... Pin
Anurag Gandhi10-Mar-10 5:21
professionalAnurag Gandhi10-Mar-10 5:21 
GeneralRe: Its really amazing... Pin
fabianse14-Mar-10 13:16
professionalfabianse14-Mar-10 13:16 
GeneralSweet Pin
Spas88-Mar-10 23:49
Spas88-Mar-10 23:49 
GeneralRe: Sweet Pin
fabianse14-Mar-10 13:19
professionalfabianse14-Mar-10 13:19 
GeneralThank's Pin
arena_luigi8-Mar-10 21:39
arena_luigi8-Mar-10 21:39 
GeneralRe: Thank's Pin
fabianse14-Mar-10 13:24
professionalfabianse14-Mar-10 13:24 
GeneralGreat work.... Pin
Ravikumar M L8-Mar-10 17:40
Ravikumar M L8-Mar-10 17:40 
GeneralRe: Great work.... Pin
fabianse14-Mar-10 13:22
professionalfabianse14-Mar-10 13:22 
GeneralWondering... Pin
Johnny J.7-Mar-10 20:32
professionalJohnny J.7-Mar-10 20:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.