System.Globalization.CompareInfo.CompareInfo.LastIndexOf C# (CSharp) Method

LastIndexOf() public method

public LastIndexOf ( string source, char value, int startIndex, int count, CompareOptions options ) : int
source string
value char
startIndex int
count int
options CompareOptions
return int
		public virtual int LastIndexOf(string source, char value,
					       int startIndex, int count,
					       CompareOptions options)
		{
			if(source == null) {
				throw new ArgumentNullException("source");
			}
			if(startIndex < 0) {
				throw new ArgumentOutOfRangeException ("startIndex");
			}
			if(count < 0 || (startIndex - count) < -1) {
				throw new ArgumentOutOfRangeException("count");
			}
			if ((options & ValidCompareOptions_NoStringSort) != options)
				throw new ArgumentException ("options");
			
			if(count==0) {
				return(-1);
			}

			if((options & CompareOptions.Ordinal)!=0) {
				for(int pos=startIndex;
				    pos > startIndex - count;
				    pos--) {
					if(source[pos]==value) {
						return(pos);
					}
				}
				return(-1);
			} else {
				return (internal_index_switch (source, startIndex,
							count, value, options,
							false));
			}
		}

Same methods

CompareInfo.CompareInfo::LastIndexOf ( string source, char value ) : int
CompareInfo.CompareInfo::LastIndexOf ( string source, char value, CompareOptions options ) : int
CompareInfo.CompareInfo::LastIndexOf ( string source, char value, int startIndex ) : int
CompareInfo.CompareInfo::LastIndexOf ( string source, char value, int startIndex, CompareOptions options ) : int
CompareInfo.CompareInfo::LastIndexOf ( string source, char value, int startIndex, int count ) : int
CompareInfo.CompareInfo::LastIndexOf ( string source, string value ) : int
CompareInfo.CompareInfo::LastIndexOf ( string source, string value, CompareOptions options ) : int
CompareInfo.CompareInfo::LastIndexOf ( string source, string value, int startIndex ) : int
CompareInfo.CompareInfo::LastIndexOf ( string source, string value, int startIndex, CompareOptions options ) : int
CompareInfo.CompareInfo::LastIndexOf ( string source, string value, int startIndex, int count ) : int
CompareInfo.CompareInfo::LastIndexOf ( string source, string value, int startIndex, int count, CompareOptions options ) : int