Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What is a value class?

0 views
Skip to first unread message

Marc

unread,
Feb 17, 2010, 5:02:34 PM2/17/10
to
I am studying something and a question in a book talks about value class.
What should be that? I trying to figure it out, but google gives too many
non relevant answers and sentences containing these two words. If somebody
would know this by hearth it would be a help. I thought struct is a value
type and class is a reference type, so neither a 'reference struct' nor a
'value class' would exists.

It's just a silly question in a book:

You need to create a simple class or structure that contains only value
types. You must create the class or structure so that it runs as efficiently
as possible. You must be able to pass the class or structure to a procedure
without concern that the procedure will modify it. Which of the following
should you create?

A reference class
B reference structure
C value class
D value structure

Correct Answer: D

A Incorrect: You could create a reference class; however, it could be
modified when passed to a procedure.
B Incorrect: You cannot create a reference structure.
C Incorrect: You could create a value class; however, structures tend to be
more efficient.
D Correct: Value structures are typically the most efficient.

I understand C is the correct anwer, but what would 'reference structure'
but also 'value class' be? Well they confirm that reference structure is non
existant nonsence, but the term value class seems to be something. Huh?

I am starting to think the book just has an error in it. :-)

Peter Duniho

unread,
Feb 17, 2010, 5:17:06 PM2/17/10
to
Marc wrote:
> [...]

> I understand C is the correct anwer, but what would 'reference
> structure' but also 'value class' be? Well they confirm that reference
> structure is non existant nonsence, but the term value class seems to be
> something. Huh?
>
> I am starting to think the book just has an error in it. :-)

Sounds like you're using the same crappy studdy materials about which
Tony Johansson has been peppering us with questions. You may find some
value, rather than asking questions that come up, in just browsing
through all the threads he's started here. :)

As far as the specific question goes, you're correct�in C#, there is
nothing specifically defined to be a "value class".

From context, it appears they may consider a class containing only
value types to be a "value class". But for the author to be consistent,
they then would have to allow "reference struct" (i.e. a structure
containing only reference types). And frankly, the distinction between
a class containing only value types and one that has reference types is
IMHO pointless.

I'll give you the same advice I offered Tony: go find something better
to study with. That book stinks.

Pete

Marc

unread,
Feb 18, 2010, 3:59:50 AM2/18/10
to

"Peter Duniho" <no.pet...@no.nwlink.spam.com> wrote

> Sounds like you're using the same crappy study materials about which Tony

> Johansson has been peppering us with questions.

It's the selfstudy material for the '536' exam.

> I'll give you the same advice I offered Tony: go find something better to
> study with. That book stinks.

Yes...As far as I have seen and found on the web, a lot more people are
saying this book has lots and lots of errors. And that for an official MS
exam selfstudy book, it's dissapointing.

I got other stuff too.


Sajjad Hasan

unread,
Jan 11, 2011, 5:10:03 AM1/11/11
to
It is an old thread, but may I say that the author may be referring to an Immutable class.
See <A href: http://blogs.msdn.com/b/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx> Link</A> for details.
Thanks.

> On Wednesday, February 17, 2010 5:02 PM Marc wrote:

> I am studying something and a question in a book talks about value class.
> What should be that? I trying to figure it out, but google gives too many
> non relevant answers and sentences containing these two words. If somebody
> would know this by hearth it would be a help. I thought struct is a value
> type and class is a reference type, so neither a 'reference struct' nor a
> 'value class' would exists.
>

> it is just a silly question in a book:


>
> You need to create a simple class or structure that contains only value
> types. You must create the class or structure so that it runs as efficiently
> as possible. You must be able to pass the class or structure to a procedure
> without concern that the procedure will modify it. Which of the following
> should you create?
>
> A reference class
> B reference structure
> C value class
> D value structure
>
> Correct Answer: D
>
> A Incorrect: You could create a reference class; however, it could be
> modified when passed to a procedure.
> B Incorrect: You cannot create a reference structure.
> C Incorrect: You could create a value class; however, structures tend to be
> more efficient.
> D Correct: Value structures are typically the most efficient.
>
> I understand C is the correct anwer, but what would 'reference structure'
> but also 'value class' be? Well they confirm that reference structure is non
> existant nonsence, but the term value class seems to be something. Huh?
>
> I am starting to think the book just has an error in it. :-)


>> On Wednesday, February 17, 2010 5:17 PM Peter Duniho wrote:

>> Marc wrote:
>>
>> Sounds like you are using the same crappy studdy materials about which


>> Tony Johansson has been peppering us with questions. You may find some
>> value, rather than asking questions that come up, in just browsing

>> through all the threads he is started here. :)
>>
>> As far as the specific question goes, you are correct?in C#, there is


>> nothing specifically defined to be a "value class".
>>
>> From context, it appears they may consider a class containing only
>> value types to be a "value class". But for the author to be consistent,
>> they then would have to allow "reference struct" (i.e. a structure
>> containing only reference types). And frankly, the distinction between
>> a class containing only value types and one that has reference types is
>> IMHO pointless.
>>

>> I will give you the same advice I offered Tony: go find something better


>> to study with. That book stinks.
>>

>> Pete


>>> On Thursday, February 18, 2010 3:59 AM Marc wrote:

>>> it is the selfstudy material for the '536' exam.


>>>
>>>
>>> Yes...As far as I have seen and found on the web, a lot more people are
>>> saying this book has lots and lots of errors. And that for an official MS

>>> exam selfstudy book, it is dissapointing.


>>>
>>> I got other stuff too.


>>> Submitted via EggHeadCafe
>>> Creating Google Motion Charts from Excel data
>>> http://www.eggheadcafe.com/tutorials/aspnet/86599bca-edda-4204-af15-7a1cf901a071/creating-google-motion-charts-from-excel-data.aspx

Sajjad Hasan

unread,
Jan 11, 2011, 5:14:34 AM1/11/11
to
It is an old thread, but may I say that the author may be referring to an Immutable class.
See<A href: http://blogs.msdn.com/b/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx> Article</A> for details.
Thanks.

> On Wednesday, February 17, 2010 5:02 PM Marc wrote:

> I am studying something and a question in a book talks about value class.
> What should be that? I trying to figure it out, but google gives too many
> non relevant answers and sentences containing these two words. If somebody
> would know this by hearth it would be a help. I thought struct is a value
> type and class is a reference type, so neither a 'reference struct' nor a
> 'value class' would exists.
>

> it is just a silly question in a book:


>
> You need to create a simple class or structure that contains only value
> types. You must create the class or structure so that it runs as efficiently
> as possible. You must be able to pass the class or structure to a procedure
> without concern that the procedure will modify it. Which of the following
> should you create?
>
> A reference class
> B reference structure
> C value class
> D value structure
>
> Correct Answer: D
>
> A Incorrect: You could create a reference class; however, it could be
> modified when passed to a procedure.
> B Incorrect: You cannot create a reference structure.
> C Incorrect: You could create a value class; however, structures tend to be
> more efficient.
> D Correct: Value structures are typically the most efficient.
>
> I understand C is the correct anwer, but what would 'reference structure'
> but also 'value class' be? Well they confirm that reference structure is non
> existant nonsence, but the term value class seems to be something. Huh?
>
> I am starting to think the book just has an error in it. :-)

>> On Wednesday, February 17, 2010 5:17 PM Peter Duniho wrote:

>> Marc wrote:
>>
>> Sounds like you are using the same crappy studdy materials about which
>> Tony Johansson has been peppering us with questions. You may find some
>> value, rather than asking questions that come up, in just browsing
>> through all the threads he is started here. :)
>>
>> As far as the specific question goes, you are correct?in C#, there is
>> nothing specifically defined to be a "value class".
>>
>> From context, it appears they may consider a class containing only
>> value types to be a "value class". But for the author to be consistent,
>> they then would have to allow "reference struct" (i.e. a structure
>> containing only reference types). And frankly, the distinction between
>> a class containing only value types and one that has reference types is
>> IMHO pointless.
>>
>> I will give you the same advice I offered Tony: go find something better
>> to study with. That book stinks.
>>
>> Pete


>>> On Thursday, February 18, 2010 3:59 AM Marc wrote:

>>> it is the selfstudy material for the '536' exam.
>>>
>>>
>>> Yes...As far as I have seen and found on the web, a lot more people are
>>> saying this book has lots and lots of errors. And that for an official MS
>>> exam selfstudy book, it is dissapointing.
>>>
>>> I got other stuff too.


>>>> On Tuesday, January 11, 2011 5:09 AM Sajjad Hasan wrote:

>>>> It is an old thread, but may I say that the author may be referring to an Immutable class.
>>>>
>>>> See <A href: http://blogs.msdn.com/b/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx> Link</A> for details.
>>>>
>>>> Thanks.


>>>> Submitted via EggHeadCafe
>>>> SharePoint Status Bar Access Via Client Side API
>>>> http://www.eggheadcafe.com/tutorials/aspnet/4bc37d0d-4e04-4202-9828-c6b717744989/sharepoint-status-bar-access-via-client-side-api.aspx

0 new messages