p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 10th, 2009, 11:11 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old September 10th, 2009, 02:24 PM
Friend of Wrox
Points: 1,882, Level: 17
Points: 1,882, Level: 17 Points: 1,882, Level: 17 Points: 1,882, Level: 17
Activity: 7%
Activity: 7% Activity: 7% Activity: 7%
 
Join Date: May 2004
Location: India
Posts: 563
Thanks: 0
Thanked 14 Times in 14 Posts
Default

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
classes).

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.
FROM MSDN
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.
(http://www.csharphelp.com/archives/archive100.html)
__________________
Om Prakash Pant
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump



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


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc