Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert a string to NSData

i have a string that I use to create a file. I now need to take that file and get it into an NSData object for sending as an email.

I'm sorry, but I haven't a clue how to get a string into an NSData object! Can someone please help me?

like image 468
SpokaneDude Avatar asked Jan 15 '11 22:01

SpokaneDude


1 Answers

Use NSData.FromString (string s), unless you mean loading a file name that is stored in a string and getting the NSData of that, in which case use NSData.FromStream (new FileStream (filename, FileMode.Open));

like image 140
Geoff Norton Avatar answered Oct 06 '22 09:10

Geoff Norton