Click here to Skip to main content
15,898,587 members
Home / Discussions / C#
   

C#

 
GeneralRe: Parsing text file - Regular Expression vs. Substring Pin
Dale Hegler14-Mar-06 3:37
Dale Hegler14-Mar-06 3:37 
QuestionForms dependency Pin
vfraenckel13-Mar-06 9:37
vfraenckel13-Mar-06 9:37 
AnswerRe: Forms dependency Pin
Colin Angus Mackay13-Mar-06 11:38
Colin Angus Mackay13-Mar-06 11:38 
GeneralRe: Forms dependency Pin
vfraenckel21-Mar-06 3:41
vfraenckel21-Mar-06 3:41 
GeneralRe: Forms dependency Pin
Colin Angus Mackay21-Mar-06 4:15
Colin Angus Mackay21-Mar-06 4:15 
QuestionDataGridView's BackgroundImage Property Pin
Bobby88713-Mar-06 9:21
Bobby88713-Mar-06 9:21 
QuestionAre variables objects? Pin
haseeb_saeed13-Mar-06 8:58
haseeb_saeed13-Mar-06 8:58 
AnswerRe: Are variables objects? Pin
Judah Gabriel Himango13-Mar-06 9:43
sponsorJudah Gabriel Himango13-Mar-06 9:43 
Everything in the .NET framework (excluding the rarely used pointers) are of type System.Object. That is the unified type system.

Now, you can start getting into some intricacies of the type system, for example, everything in the unified type system is either a reference type or a value type. Any C# 'struct' is a value type. Any C# 'class' is a reference type. System.Int32 (C#'s 'int') is a value type. When you call .ToString() on it, it will create a string representation of the integer.

Structs/value types are treated differently in .NET. For one, they are high-performance as they do not require a heap allocation or a garbage collection (whereas references type require both). When you pass a value type to a function, a copy of the value is actually passed:

int i = 5;
MyFunc(i);
// i is still 5, because a copy of the value was passed to the function. All value types are passed as copies to functions.
...
void MyFunc(int theInteger)
{
   theInteger = 10;
}


Also, if you cast a value type to type System.Object, a process called boxing is induced:

int i = 5;
object o = i; // boxing induced, heap allocation done to allocate a new object onto the heap


Does that answer your question?

Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Moral Muscle
The apostle Paul, modernly speaking: Epistles of Paul

Judah Himango


AnswerRe: Are variables objects? Pin
Divyang Mithaiwala13-Mar-06 17:44
Divyang Mithaiwala13-Mar-06 17:44 
GeneralRe: Are variables objects? Pin
J4amieC13-Mar-06 23:07
J4amieC13-Mar-06 23:07 
QuestionSetup and Deployment Pin
JMichael246813-Mar-06 8:57
JMichael246813-Mar-06 8:57 
AnswerRe: Setup and Deployment Pin
Robert Rohde13-Mar-06 10:19
Robert Rohde13-Mar-06 10:19 
QuestionHandling Text in Text Box Pin
haseeb_saeed13-Mar-06 8:45
haseeb_saeed13-Mar-06 8:45 
AnswerRe: Handling Text in Text Box Pin
Dave Kreskowiak13-Mar-06 10:39
mveDave Kreskowiak13-Mar-06 10:39 
AnswerRe: Handling Text in Text Box Pin
Drew McGhie13-Mar-06 11:42
Drew McGhie13-Mar-06 11:42 
Questiongetting GPS coordinates on pocketpc Pin
BlackDice13-Mar-06 8:15
BlackDice13-Mar-06 8:15 
AnswerRe: getting GPS coordinates on pocketpc Pin
Dave Kreskowiak13-Mar-06 10:36
mveDave Kreskowiak13-Mar-06 10:36 
NewsRe: getting GPS coordinates on pocketpc Pin
BlackDice15-Mar-06 5:22
BlackDice15-Mar-06 5:22 
GeneralRe: getting GPS coordinates on pocketpc Pin
Dave Kreskowiak15-Mar-06 11:26
mveDave Kreskowiak15-Mar-06 11:26 
QuestionMicrosoft.Jet.OLEDB Extended Properties Pin
mcljava13-Mar-06 8:10
mcljava13-Mar-06 8:10 
AnswerRe: Microsoft.Jet.OLEDB Extended Properties Pin
mcljava15-Mar-06 7:54
mcljava15-Mar-06 7:54 
QuestionHow to find Serializable attribute with reflection? Pin
vineas13-Mar-06 7:18
vineas13-Mar-06 7:18 
AnswerRe: How to find Serializable attribute with reflection? Pin
leppie13-Mar-06 7:58
leppie13-Mar-06 7:58 
GeneralRe: How to find Serializable attribute with reflection? Pin
vineas13-Mar-06 8:23
vineas13-Mar-06 8:23 
GeneralRe: How to find Serializable attribute with reflection? Pin
superpzgpzg8-Dec-09 21:11
superpzgpzg8-Dec-09 21:11 

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.