e-learning question about globalization(culture)

T

Tony Johansson

Hi!

Here is the question from e-learning about globalization: Which method
illustrates how to retirieve information for the current culture of the
application.(Choose all that apply)

1. Create a new instance of the CultureInfo class, and instansiate it with
no values specified in the constructor.
2. Use CurrentCulture property of the CurrentThread property of the Thread
instance.
3. Create a new instance of the CultureInfo class, and use an invariant
culture.
4. Create an instance of the CultureInfo class using a specific culture, and
check the CurrentCulture property.

According to e-learning is the correct answer. 2 and 4.

I can easy understand that 2 is the correct answer.
I might select 4 as an alternative if I had understood this alternative.
So can someone explain what they mean with this alternative 4

//Tony
 
A

Arne Vajhøj

Here is the question from e-learning about globalization: Which method
illustrates how to retirieve information for the current culture of the
application.(Choose all that apply)

1. Create a new instance of the CultureInfo class, and instansiate it with
no values specified in the constructor.
2. Use CurrentCulture property of the CurrentThread property of the Thread
instance.
3. Create a new instance of the CultureInfo class, and use an invariant
culture.
4. Create an instance of the CultureInfo class using a specific culture, and
check the CurrentCulture property.

According to e-learning is the correct answer. 2 and 4.

I can easy understand that 2 is the correct answer.
I might select 4 as an alternative if I had understood this alternative.
So can someone explain what they mean with this alternative 4

CultureInfo is relevant because: for reasons unknown to me
they have made a static property CurrentCulture of CultureInfo
class that returns Thread.CurrentCulture !

All the text about creating an instance of CultureInfo is
bullshit, because it is a static property.

Arne
 
M

Martin Honnen

Tony said:
Hi!

Here is the question from e-learning about globalization: Which method
illustrates how to retirieve information for the current culture of the
application.(Choose all that apply)

1. Create a new instance of the CultureInfo class, and instansiate it with
no values specified in the constructor.
2. Use CurrentCulture property of the CurrentThread property of the Thread
instance.
3. Create a new instance of the CultureInfo class, and use an invariant
culture.
4. Create an instance of the CultureInfo class using a specific culture, and
check the CurrentCulture property.

According to e-learning is the correct answer. 2 and 4.

I can easy understand that 2 is the correct answer.
I might select 4 as an alternative if I had understood this alternative.
So can someone explain what they mean with this alternative 4

There is a static property
CultureInfo.CurrentCulture
you can check, that is what might be asked for with "4." or at least is
an answer to the original question. But of course then the first part of
"4." saying "Create an instance of the CultureInfo class using a
specific culture" does not make sense or at least is not necessary as
you don't need to create an instance to check a static property.
Is that e-learning material about C#? I think with VB.NET you can even
do e.g.
Dim cu As New CultureInfo("de-DE")
and then access cu.CurrentCulture. Nevertheless the instance is
unnecessary, doing
CultureInfo.CurrentCulture
suffices.
 
T

Tony Johansson

Martin Honnen said:
There is a static property
CultureInfo.CurrentCulture
you can check, that is what might be asked for with "4." or at least is an
answer to the original question. But of course then the first part of "4."
saying "Create an instance of the CultureInfo class using a specific
culture" does not make sense or at least is not necessary as you don't
need to create an instance to check a static property.
Is that e-learning material about C#? I think with VB.NET you can even do
e.g.
Dim cu As New CultureInfo("de-DE")
and then access cu.CurrentCulture. Nevertheless the instance is
unnecessary, doing
CultureInfo.CurrentCulture
suffices.

But I mean when I read the question and have to change the meaning of the
sentence it become difficult
to know which answer is the right one. As it was in this case.
It it questions like this one on the real exam ?

//Tony
 
P

Patrice

4. Create an instance of the CultureInfo class using a specific culture,
But I mean when I read the question and have to change the meaning of the
sentence it become difficult
to know which answer is the right one. As it was in this case.
It it questions like this one on the real exam ?

My understanding now is that the question could have been "Increment the i
integer by 1" and then check CurrentCulture.

IMO this is to trap those who could think that creating a new instance would
change the current culture.

Unfortunately it can also trap those who think that creating a new culture
info is useless for this particular goal. But IMO they don't mean that you
are creating an instance for this particular goal. This instance could be
used later in the code for something unrelated to reading the current
culture. So technically response 4 is correct and this code is not even
necessarily stupid.

I would likely have been caught also seeing just the immediate goal rather
than a whole context we don't know about...

It seems it's best to avoid being too clever. You just have to take each
question and see if it gives the result you want regardless of how clever
seems the current code fragment...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top