Overview
In C#, String.Contains()
is an instance method of the String
class. It is used to find whether a given string contains characters. If it finds a matching substring
in this particular string, it returns True
. If not, it returns False
.
Syntax
public bool Contains (string substring)// or public bool Contains (Char value)
Parameters
String substring // the string to be searched// or Char value // character to be seeked
Returns value
Boolean
: It returns True
or False
based on whether the string contains the given substring
.
If the passed substring
is null, itthrows an ArgumentNullException
error.