Add necessary namespace
using System.Linq;
Then you can use linq Contains()
method
string[] printer = {"jupiter", "neptune", "pangea", "mercury", "sonic"};
if(printer.Contains("jupiter"))
{
Process.Start("BLAH BLAH CODE TO ADD PRINTER VIA WINDOWS EXEC"");
}
More Related Contents:
- How to convert UTF-8 byte[] to string
- .NET / C# – Convert char[] to string
- Operator ‘==’ cannot be applied to operands of type ‘char’ and ‘string’
- C# String Array Returns Wrong Values
- How can I convert String to Int?
- C# string replace does not actually replace the value in the string [duplicate]
- How do I replace the *first instance* of a string in .NET?
- Using C# to check if string contains a string in string array
- Best way to repeat a character in C#
- Merging two arrays in .NET
- Are there any Fuzzy Search or String Similarity Functions libraries written for C#? [closed]
- Get the index of the nth occurrence of a string?
- Why do C# multidimensional arrays not implement IEnumerable?
- Is there a C# case insensitive equals operator?
- How do you get the width and height of a multi-dimensional array?
- Characters in string changed after downloading HTML from the internet
- Memory Efficiency and Performance of String.Replace .NET Framework
- Parse C# string to DateTime
- Easier way of writing null or empty?
- How can I get a character in a string by index?
- .Net Data structures: ArrayList, List, HashTable, Dictionary, SortedList, SortedDictionary — Speed, memory, and when to use each? [closed]
- What is the difference between .Equals and == [duplicate]
- What’s a good way of doing string templating in .NET?
- Is there a “String.Format” that can accept named input parameters instead of index placeholders? [duplicate]
- Wildcard equivalent in C# generics
- Convert binary string into integer
- DateTime conversion from string C#
- Why only literal strings saved in the intern pool by default?
- Checking for null before ToString()
- Why is the length of this string longer than the number of characters in it?