samedi 27 juin 2015

Get Last Element of a/an List/Array

Sometimes I need to get the last element in an Array if I split something. Although I didn't found any way to do it better than this way:

_Path.Split('\\')[_Path.Split('\\').Length - 1]

Is there maybe an easier way to do this than this one? In this case it's pretty nice to understand, but if it gets longer, it isn't anymore.

Aucun commentaire:

Enregistrer un commentaire