How to convert string to NSData

I have a line that I use to create a file. Now I need to take this file and transfer it to the NSData object for sending as email.

Sorry, but I do not know how to get a string in an NSData object! Can someone please help me?

+6
source share
1 answer

Use NSData.FromString (string s) if you do not want to load the file name that is stored in the string and get NSData, in this case use NSData.FromStream (new FileStream (filename, FileMode.Open));

+17
source share

All Articles