Click here to Skip to main content
15,908,445 members
Home / Discussions / C#
   

C#

 
GeneralRe: rtf and streams Pin
panoskatws5-Apr-08 4:54
panoskatws5-Apr-08 4:54 
GeneralRe: rtf and streams Pin
mav.northwind4-Apr-08 23:24
mav.northwind4-Apr-08 23:24 
GeneralRe: rtf and streams Pin
panoskatws5-Apr-08 5:16
panoskatws5-Apr-08 5:16 
GeneralThreading problem Pin
Rick van Woudenberg4-Apr-08 2:53
Rick van Woudenberg4-Apr-08 2:53 
GeneralRe: Threading problem Pin
leppie4-Apr-08 3:42
leppie4-Apr-08 3:42 
GeneralRe: Threading problem Pin
SeeBees4-Apr-08 16:15
SeeBees4-Apr-08 16:15 
GeneralRe: Threading problem Pin
S. Senthil Kumar5-Apr-08 13:56
S. Senthil Kumar5-Apr-08 13:56 
Questionis there a way to restrict possible values of a string param in a method Pin
Adam Harbour4-Apr-08 2:40
Adam Harbour4-Apr-08 2:40 
Hi I have a c# method that takes as one of its params. I would like to restrict the possible values. I realize that enums would achieve this but I cannot create enums with a string value only integer values

eg

public string ProcessTrade(string value1, string values2)
{
...method only allows value 1 to be A, B or C
and should not use code in the method to do this,
the compiler should catch it
}


calling
string result = ProcessTrade("E","ABC") should complie ok, but
string result = ProcessTrade("EEE","ABC") should not complie


Ideally an emun would achieve this if string enums worked

eg

//this wont work because enums have to have an in value
//but this is what i would like

enum TradeType
{
Equity = "E",
MuniBond = "M",
Treasury = "T",
Agency = "A"
}

If an enum like this existed I could then create the method


public string ProcessTrade(TradeType CurrentTradeType, string values2)
{
Switch(CurrentTradeType)
Case CurrentTradeType.Equity:
….etc etc
}


And it would be called in a tidy fashion thus:

String Result = ProcessTrade(TradeType.Equity,”ABC”)
GeneralRe: is there a way to restrict possible values of a string param in a method Pin
Pete O'Hanlon4-Apr-08 2:50
mvePete O'Hanlon4-Apr-08 2:50 
GeneralWrong data returned! Pin
Graham_44-Apr-08 1:24
Graham_44-Apr-08 1:24 
GeneralPlugins for MS Office, Internet explorer using C# Pin
Vikas K.4-Apr-08 0:53
Vikas K.4-Apr-08 0:53 
GeneralRe: Plugins for MS Office, Internet explorer using C# Pin
John_Adams4-Apr-08 1:06
John_Adams4-Apr-08 1:06 
GeneralRe: Plugins for MS Office, Internet explorer using C# Pin
Vikas K.4-Apr-08 1:24
Vikas K.4-Apr-08 1:24 
GeneralRe: Plugins for MS Office, Internet explorer using C# Pin
Member 38312474-Apr-08 3:27
Member 38312474-Apr-08 3:27 
QuestionHow to get Keypress event to menuStrip Pin
ASysSolvers3-Apr-08 23:48
ASysSolvers3-Apr-08 23:48 
GeneralBLOB reading and writing C# Pin
Dev Motiramani3-Apr-08 23:25
Dev Motiramani3-Apr-08 23:25 
GeneralRe: BLOB reading and writing C# Pin
Giorgi Dalakishvili3-Apr-08 23:32
mentorGiorgi Dalakishvili3-Apr-08 23:32 
GeneralRe: BLOB reading and writing C# Pin
Dev Motiramani4-Apr-08 0:06
Dev Motiramani4-Apr-08 0:06 
Generalusing C# to implement Windows Service Pin
George_George3-Apr-08 22:32
George_George3-Apr-08 22:32 
GeneralRe: using C# to implement Windows Service Pin
Giorgi Dalakishvili3-Apr-08 22:34
mentorGiorgi Dalakishvili3-Apr-08 22:34 
GeneralRe: using C# to implement Windows Service Pin
George_George3-Apr-08 23:34
George_George3-Apr-08 23:34 
GeneralRe: using C# to implement Windows Service Pin
N a v a n e e t h3-Apr-08 23:36
N a v a n e e t h3-Apr-08 23:36 
GeneralRe: using C# to implement Windows Service Pin
George_George3-Apr-08 23:55
George_George3-Apr-08 23:55 
GeneralExtending Visual Studio 2005 Pin
Strannick3-Apr-08 22:24
Strannick3-Apr-08 22:24 
GeneralRe: Extending Visual Studio 2005 Pin
Pete O'Hanlon3-Apr-08 23:07
mvePete O'Hanlon3-Apr-08 23:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.