c# substring before and after character code example Example: substring c# after character var result = str.Substring(str.LastIndexOf('-') + 1);