Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Professional C# 2005 with .NET 3.0 ISBN: 978-0-470-12472-7
This is the forum to discuss the Wrox book Professional C# 2005 with .NET 3.0 by Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner; ISBN: 9780470124727
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C# 2005 with .NET 3.0 ISBN: 978-0-470-12472-7 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 10th, 2009, 10:11 AM
Registered User
Join Date: Sep 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question differencies

Please Give me the Diferences for below::

classes and Structure
int and int32
static and non static method
Static class and non static class
boxing and unboxing

pls reply early........its important
  #2 (permalink)  
Old September 10th, 2009, 01:24 PM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts

static and non static method
For "static" you don't need an instance of the class to use them, you can
just use MyClass.FunctionName();
It makes sense in some circumstances, would you really want to create an
instance of the Math class just to perform some Cosine operations, or would
you prefer just to do Math.Cosine()?
As for members, if you make a member (such as Int32) static it will be
shared amongst all instances of your class (including instances of descended

What is the difference between class and structure?
Structure: Initially (in C) a structure was used to bundle different type of data types together to perform a particular functionality. But C++ extended the structure to contain functions also. The major difference is that all declarations inside a structure are by default public.
Class: Class is a successor of Structure. By default all the members inside the class are private.

int and int32

Int32 is the System.Int32 class, while int is an alias for System.Int32.
The same applies for String (uppercase S) which is System.String, while string (lowercase S) is an alias for System.String.
So basically int is the same thing as Int32, and string is the same thing as Int32. It's down to user's preference which one to use but most prefer to use int and string as they are easier to type and more familiar among C++ programmers.

Static class and non static class
A static class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated. In other words, you cannot use the new keyword to create a variable of the class type. Because there is no instance variable, you access the members of a static class by using the class name itself.

The main features of a static class are:
* They only contain static members.
* They cannot be instantiated.
* They are sealed.
* They cannot contain Instance Constructors

boxing and unboxing
Boxing and unboxing is a essential concept in C#?s type system. With Boxing and unboxing one can link between value-types and reference-types by allowing any value of a value-type to be converted to and from type object. Boxing and unboxing enables a unified view of the type system wherein a value of any type can ultimately be treated as an object.
Converting a value type to reference type is called Boxing.Unboxing is an explicit operation.
C# provides a ?unified type system?. All types?including value types?derive from the type object. It is possible to call object methods on any value, even values of ?primitive? types such as int.
Boxing and unboxing enable value types to be treated as objects. Boxing a value type packages it inside an instance of the Object reference type. This allows the value type to be stored on the garbage collected heap. Unboxing extracts the value type from the object. In this example, the integer variable i is boxed and assigned to object o.
Om Prakash Pant
Click the "Thanks" button if this post helped you.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

All times are GMT -4. The time now is 07:58 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.