Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is String.LegacyMode property for exactly?

When I decompile String.IndexOf (String) method, I see this;

[__DynamicallyInvokable]
public int IndexOf(string value)
{
  return this.IndexOf(value, string.LegacyMode ? StringComparison.Ordinal : StringComparison.CurrentCulture);
}

In the second parameter definition:

  • if string.LegacyMode is true, StringComparison.Ordinal is evaluated.
  • if string.LegacyMode is false, StringComparison.CurrentCulture is evaluated.

But what does String.LegacyMode exactly mean?

When I decompile this property I see this:

internal static bool LegacyMode
{
  get
  {
    return CompatibilitySwitches.IsAppEarlierThanSilverlight4;
  }
}

I searched about String.LegacyMode and CompatibilitySwitches.IsAppEarlierThanSilverlight4 on Google first but I couldn't find any useful information.

Can you enlighten me?

like image 488
Soner Gönül Avatar asked Oct 22 '13 10:10

Soner Gönül


People also ask

What is TinyDB used for?

TinyDB is used to store persistent data directly on the Android device; this is useful for highly personalized apps where the user won't need to share her data with another device or person, as in No Texting While Driving.

What is the role of TinyDB in App Inventor?

TinyDB. TinyDB is a non-visible component that stores data for an app. Apps created with App Inventor are initialized each time they run. This means that if an app sets the value of a variable and the user then quits the app, the value of that variable will not be remembered the next time the app is run.


1 Answers

Why not check the source, MSDN :)

Ninja edit: I just saw the link you posted at the top of your question. Select Silverlight from the other versions dropdown and you'll see the note below.

String.IndexOf Method

Notes to Callers

Starting in Silverlight 4, the behavior of the String.IndexOf(String) method has changed. In Silverlight 4, it performs a case-sensitive and culture-sensitive comparison using the current culture to find the first occurrence of value. This conforms to the behavior of the String.IndexOf(String) method in the full .NET Framework. In Silverlight 2 and Silverlight 3, String.IndexOf(String) performs an ordinal comparison. If the common language runtime determines that a Silverlight-based application was compiled using either Silverlight 2 or Silverlight 3, it performs an ordinal comparison; otherwise, it performs a culture-sensitive comparison.

like image 182
EventHorizon Avatar answered Oct 19 '22 08:10

EventHorizon