Linked Questions

77 votes
4 answers
139k views

I'm reading file content and take string at exact location like this string fileContentMessage = File.ReadAllText(filename).Substring(411, 3); Output will always be either Ok or Err On the other ...
user1765862's user avatar
  • 14.3k
18 votes
4 answers
32k views

I have an enum: public enum Color { Red, Blue, Green, } Now if I read those colors as literal strings from an XML file, how can I convert it to the enum type Color. class TestClass { ...
Sergio Tapia's user avatar
  • 41.5k
3 votes
6 answers
3k views

Possible Duplicate: How do I Convert a string to an enum in C#? How to Convert (to Cast) a string ( a text) to be Enum tag value in C#
avrsoft's user avatar
  • 31
1 vote
2 answers
18k views

I have one enum like below public enum Colors { red, blue, green, yellow } I want to use it switch case public void ColorInfo(string colorName) { switch (colorName) { ...
vmb's user avatar
  • 3,088
2 votes
4 answers
601 views

Possible Duplicate: How do I Convert a string to an enum in C#? I have an enum of type int: public enum BlahType { blah1 = 1, blah2 = 2 } If I have a string: string something = "...
mrblah's user avatar
  • 104k
5 votes
4 answers
841 views

Possible Duplicate: How do I Convert a string to an enum in C#? Enums returning int value I have declare an enumeration:- public enum Car { SELECT = 0, AUDI = 1, ...
user1327064's user avatar
  • 4,347
5 votes
3 answers
637 views

I trying to convert from WPF combobox selected value to enumurator it return not valid cast in the runtime otherwise the string and the enum name is matched my code is Siren.PfundMemberWebServices....
Badr Hussien's user avatar
-3 votes
1 answer
9k views

I have some problems with using enums with switch.My task is to enter the name of the country and then show which part of the world is that one. I can't read enums from the keyboard.Did I make ...
Lavander.B's user avatar
2 votes
6 answers
1k views

I would like to clean my code and make it more simple. Now I've got a method which returns and int value. private int ReturnMyValue(string line) { switch (line) { case "ST": ...
Alice's user avatar
  • 193
0 votes
1 answer
2k views

I have a user inputting a day (Monday) and a week number in order to search for a value in an array. However, to get the array output, I need the row and column numbers. The row number can be obtained ...
Anon's user avatar
  • 141
4 votes
2 answers
271 views

I have the following code: public string GetSetting(string setting) { return db2.ExecuteScalar<string>("SELECT VALUE FROM Setting WHERE SettingType = ?", setting); } public enum NOA { ...
Alan2's user avatar
  • 24.8k
0 votes
1 answer
1k views

The enum: public enum EnumName { Gary = 1, Dave = 2 } The input: string inputValue = "Gary"; What is the best way to retrieve the value from the enum for this string? I.e. return the value 1....
MattMcGowan's user avatar
2 votes
1 answer
2k views

I am trying to import a file with a list of latitude and longitude coordinates. In Visual C#, and using GMAP.NET, a marker is placed for every coordinate pair. I want multiple files to be able to be ...
manateejoe's user avatar
1 vote
1 answer
825 views

So now I can retrieve a string and integer by doing this for string LastName = formCollection["LastName"] and for int Amount = int.Parse(formCollection["Amount"]) My problem now is for enum. I ...
Woshooo's user avatar
  • 268
-4 votes
1 answer
850 views

I have an Enum public enum MyEnum { value1= 1, value2= 2, value3= 3, value4= 4 } How do I get the integer values , if I give the string as input , say input--&...
Roby A's user avatar
  • 36

15 30 50 per page
1
2 3 4 5 6