-7

I just took online (non-course related) test on C# and this question came up to me:

Are there any difference to the C# language based on country/region?

0

3 Answers 3

4

No, there are no differences whatsoever. There is just one language specification. Period.

Imagine what happens to a programming language specification that changes depending on the region you are in...

What if this has a different meaning in the USA then in Europe:

decimal d = 1.500;

Is it 1.5 (one and a half) or 1,500 (one thousand five hundred)?

6
  • 1
    does that really deserve a down vote? I assumed this was the case and I googled it, I figured the best place to ask was here. Oct 15, 2014 at 18:17
  • What about DateTime, currency,... formatting... Oct 15, 2014 at 18:17
  • 2
    @CommuSoft unrelated to the language
    – dee-see
    Oct 15, 2014 at 18:18
  • 1
    @CommuSoft: That is about the language specification, not the use of it. Oct 15, 2014 at 18:19
  • 1
    @PatrickHofman: I agree. But one still should be careful. Some people assume double.Parse("1.5"); will work, regardless of the environment, while in many European countries this will fail. I agree that's not part of the language. But is something one should take into account. Oct 15, 2014 at 18:33
3

Well the DateTime typesetting will be different depending on the culture. For instance in the U.S., it will read, the same goes with currencies, dialogs (the YesNo buttons will be different, etc.):

10/15/2014 8:16:08 PM

Whereas in France it will read:

15/10/2014 20:17:08

Example (with the csharp interactive shell):

Mono C# Shell, type "help;" for help

Enter statements below.
csharp> using System.Threading;
csharp> using System.Globalization;
csharp> Console.WriteLine(DateTime.Now); 
10/15/2014 8:18:12 PM
csharp> Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
csharp> Console.WriteLine(DateTime.Now);                                
15/10/2014 20:18:46

In short all settings that depend on a country/culture/natural language will be set locally (as @joppiesaus mentions, Europeans use a comma where Americans use the "decimal dot"). But the compiler is uniform.

Note however this has nothing to do with C# itself. After all C# is a standardized language with a deterministic virtual machine. But the "environment" in which it runs, can set default values differently.

Finally, as @philippelhardy indicates, there are some patents that can cause problems. For instance Mono is a clone of C#. While Microsoft Silverlight can play DRM protected media files, Mono's Moonlight can't, because Microsoft didn't license their PlayReader. See here for more information.

0
3

The short answer is no. It's a programming language and I don't see why it would be different in other countries.

The long answer is no, but there are some differences(not in the programming language itself, thought). For example: I live in the Netherlands, so the computer sees me like I'm Dutch. If I enter Convert.ToDouble(someString), in the US the . would seperate the number, while in Europe the , seperates the number.

That's related to the culture the program is running in(CultureInfo), which is partly based on region(pre-installed computers, internet, ...)

1
  • 4
    Your account is set to use Dutch culture, which is then seen in System.Globalization.CultureInfo.CurrentCulture. It's not inferred from your location (hopefully).
    – nrodic
    Oct 15, 2014 at 18:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.