46 people like it.

Byte literals

Demonstrates an array initialized from byte literals, which use the 'uy' suffix, and an array initialized from a string byte array literal

1: 
2: 
3: 
4: 
open System.Text

let bytes = [| 104uy; 101uy; 108uy; 108uy; 111uy |]
printfn "%s" (Encoding.ASCII.GetString(bytes))
namespace System
namespace System.Text
val bytes : byte []

Full name: Script.bytes
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
type Encoding =
  member BodyName : string
  member Clone : unit -> obj
  member CodePage : int
  member DecoderFallback : DecoderFallback with get, set
  member EncoderFallback : EncoderFallback with get, set
  member EncodingName : string
  member Equals : value:obj -> bool
  member GetByteCount : chars:char[] -> int + 3 overloads
  member GetBytes : chars:char[] -> byte[] + 5 overloads
  member GetCharCount : bytes:byte[] -> int + 2 overloads
  ...

Full name: System.Text.Encoding
property Encoding.ASCII: Encoding
Encoding.GetString(bytes: byte []) : string
Encoding.GetString(bytes: byte [], index: int, count: int) : string

More information

Link:http://fssnip.net/3m
Posted:8 years ago
Author:Tim Robinson
Tags: byte , literal