0

I have an NSUrl object and want to read the file name. While searching for existing solutions on StackOverflow I found https://stackoverflow.com/a/19964302/25282 which is for iOS but it uses syntax like return [yourURL lastPathComponent]; where it is unclear to me how to translate it into the C# that I have to use in Xamarin.iOS.

Christian
  • 25,249
  • 40
  • 134
  • 225
  • You can try this `string fileName = (new NSUrl(file.Url, false)).LastPathComponent;` – R15 Nov 19 '18 at 14:09

1 Answers1

2

the equivalent C# for this Obj-C code

return [yourURL lastPathComponent];

is

return yourURL.LastPathComponent;

where yourURL is a NSUrl;

Jason
  • 86,222
  • 15
  • 131
  • 146