Monobjc.Foundation.NSData.DataFromResource C# (CSharp) Method

DataFromResource() public static method

Create a NSData from a manifest resource stream.
public static DataFromResource ( Type type, String resourceName ) : NSData
type System.Type The type whose assembly contains the manifest resource.
resourceName String Name of the resource.
return NSData
        public static NSData DataFromResource(Type type, String resourceName)
        {
            Assembly assembly = type.Assembly;
            NSData data = null;
            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
            {
                if (stream != null)
                {
                    data = DataFromStream(stream);
                    stream.Close();
                }
            }
            return data;
        }