static public CFUrl FromUrlString(string url, CFUrl baseurl) { // CFString ctor will throw an ANE if null using (var str = new CFString(url)){ return(FromStringHandle(str.Handle, baseurl)); } }
internal static CFUrl FromStringHandle(IntPtr cfstringHandle, CFUrl baseurl) { IntPtr handle = CFURLCreateWithString(IntPtr.Zero, cfstringHandle, baseurl != null ? baseurl.Handle : IntPtr.Zero); if (handle == IntPtr.Zero) { return(null); } return(new CFUrl(handle, true)); }