Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Get early access and see previews of new features.
In F# how do you assign the entire contents of a file (text file where it's 100% string type) to a variable?
System.IO.File.ReadAllText(path)
let content = File.ReadAllText(path)
You'd just a let binding, and the same System.IO functions that are normally available:
System.IO
let theVariable = System.IO.File.ReadAllText pathToFile
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
System.IO.File.ReadAllText(path)
let content = File.ReadAllText(path)
?