Skip to content

better examples for #r #38292

Open
Open
@daveyostcom

Description

@daveyostcom

Type of issue

Missing information

Description

This is the example given

#r "nuget: Newtonsoft.Json"
open Newtonsoft.Json

let data = {| Name = "Don Syme"; Occupation = "F# Creator" |}
JsonConvert.SerializeObject(data)

That’s too simplistic. If you add this example, you can tell more of the story:

#r "nuget: Mono.Posix.NETStandard"
open Mono.Unix.Native

and even more:

#r "nuget: NaturalStringExtensions"

  let comparator a b = System.NaturalStringComparer().Compare(a, b)

These examples would help to avoid mystification in cases where the names in the #r and the usage differ.

Page URL

https://learn.microsoft.com/en-us/dotnet/fsharp/tools/fsharp-interactive/

Content source URL

https://github.com/dotnet/docs/blob/main/docs/fsharp/tools/fsharp-interactive/index.md

Document Version Independent Id

400ddb93-a841-963b-58cc-21f506b13b61

Article author

cartermp

Metadata

  • ID: db36a87c-0928-52ce-38f3-1555e450cce1
  • Product: dotnet-fsharp

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions