System.Globalization

I am running this code:

let dateRange (first:System.DateTime) count =
seq {for i in 0..(count-1) -> first.AddDays(float i)}

and getting this message:

"The type referenced through 'System.Globalization.CultureInfo is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Globalization'. (using external F# compiler)

I added System.Globalization.dll to the Query Properties/Additional References tab and I am still getting this message. What is wrong?

Comments

  • This works for me. What version of LINQPad are you using?
  • Issue: Cannot reference CultureInfo.InvariantCulture
    Environment: LINQPad5 (Free Edition) v5.36.03

    Repo steps:
    Open Query Properties with F4 key
    Use "Add..." button to "Add Custom Assembly Reference"
    Add "System.Globalization"
    Click "Set as default for new queries",

    but I still cannot referencing " CultureInfo"

    Here is the part of LINQ pipeline I am having trouble with:
    .Select(n => new { Name = n[0].Trim(), DOB = DateTime.ParseExact(n[1].Trim(), "d/m/yyyy", CultureInfo.InvariantCulture) })

    Thank you for your time and help!

  • After reading your other comment, I have found the solution:

    F4 key to open Query Properties panel
    Add mscorlib.dll
    Under tab "Additonal Namespace Imports", click "Pick from assemblies"
    Select assembly "mscorlib.dll" and namespace "System.Globalization.dll"

    Thank you for making this great tool and other great presentations

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!