Click here to Skip to main content
16,004,854 members
Home / Discussions / C#
   

C#

 
GeneralRe: New in .NET 2.0 Pin
Christian Graus17-May-07 3:30
protectorChristian Graus17-May-07 3:30 
GeneralRe: New in .NET 2.0 Pin
Judah Gabriel Himango17-May-07 5:18
sponsorJudah Gabriel Himango17-May-07 5:18 
AnswerRe: New in .NET 2.0 Pin
Russell Jones17-May-07 3:52
Russell Jones17-May-07 3:52 
AnswerRe: New in .NET 2.0 Pin
Nissim Salomon17-May-07 5:24
Nissim Salomon17-May-07 5:24 
Questionhow to get textbox control? Pin
newtocsharp17-May-07 3:14
newtocsharp17-May-07 3:14 
AnswerRe: how to get textbox control? Pin
Judah Gabriel Himango17-May-07 5:47
sponsorJudah Gabriel Himango17-May-07 5:47 
QuestionHelp needed to convert function to a generic function Pin
Jim Taylor17-May-07 3:11
Jim Taylor17-May-07 3:11 
AnswerRe: Help needed to convert function to a generic function Pin
Not Active17-May-07 4:12
mentorNot Active17-May-07 4:12 
static T[] CommaSeparatedStringToIEnumerable<T>(string values)<br />
{<br />
    List<string> list = new List<string>(values.Split(','));<br />
    List<T> ret = new List<T>();<br />
<br />
    foreach(string value in list)<br />
        ret.Add(ConvertValue<T>(value));<br />
    <br />
    return ret.ToArray();<br />
}<br />
<br />
static T ConvertValue<T>(object value)<br />
{<br />
    Converter<object, T> convert =<br />
    new Converter<object, T>(delegate(object val) { return (T)val; });<br />
<br />
    switch(typeof(T).ToString())<br />
    {<br />
        case "System.Int16":<br />
        case "System.Int32":<br />
            int RetInt;<br />
            if(int.TryParse(value.ToString(), out RetInt))<br />
                return convert(RetInt);<br />
            break;<br />
<br />
        case "System.Single":<br />
            float RetFloat;<br />
            if(float.TryParse(value.ToString(), out RetFloat))<br />
                return convert(RetFloat);<br />
            break;<br />
<br />
        case "System.Double":<br />
            double RetDouble;<br />
            if(double.TryParse(value.ToString(), out RetDouble))<br />
                return convert(RetDouble);<br />
            break;<br />
<br />
        default:<br />
            return convert(value);<br />
    }<br />
<br />
    return convert(value);<br />
}



only two letters away from being an asset

GeneralRe: Help needed to convert function to a generic function Pin
Jim Taylor17-May-07 4:59
Jim Taylor17-May-07 4:59 
AnswerRe: Help needed to convert function to a generic function Pin
Judah Gabriel Himango17-May-07 5:11
sponsorJudah Gabriel Himango17-May-07 5:11 
GeneralRe: Help needed to convert function to a generic function Pin
Jim Taylor17-May-07 5:34
Jim Taylor17-May-07 5:34 
GeneralRe: Help needed to convert function to a generic function Pin
Not Active17-May-07 6:20
mentorNot Active17-May-07 6:20 
GeneralRe: Help needed to convert function to a generic function Pin
Judah Gabriel Himango17-May-07 7:15
sponsorJudah Gabriel Himango17-May-07 7:15 
AnswerRe: Help needed to convert function to a generic function Pin
Nissim Salomon20-May-07 0:19
Nissim Salomon20-May-07 0:19 
QuestionWhat are the Books on C#..?? Pin
IamPoojaa17-May-07 2:39
IamPoojaa17-May-07 2:39 
AnswerRe: What are the Books on C#..?? Pin
Sathesh Sakthivel17-May-07 2:51
Sathesh Sakthivel17-May-07 2:51 
GeneralRe: What are the Books on C#..?? Pin
IamPoojaa17-May-07 3:08
IamPoojaa17-May-07 3:08 
GeneralRe: What are the Books on C#..?? Pin
Sathesh Sakthivel17-May-07 3:12
Sathesh Sakthivel17-May-07 3:12 
AnswerRe: What are the Books on C#..?? Pin
Kevin McFarlane17-May-07 3:13
Kevin McFarlane17-May-07 3:13 
QuestionTAPI Multmedia transmission Pin
CallieClearence17-May-07 2:21
CallieClearence17-May-07 2:21 
QuestionDiff b/w Windows Control Library and Class Library Pin
Rahul8317-May-07 0:52
Rahul8317-May-07 0:52 
AnswerRe: Diff b/w Windows Control Library and Class Library Pin
Pete O'Hanlon17-May-07 1:54
mvePete O'Hanlon17-May-07 1:54 
QuestionHow to connect c# (2.0 Framework [Dotnet 2005]) desktop application with ms sql 2000 Pin
prince_ppy17-May-07 0:42
prince_ppy17-May-07 0:42 
AnswerRe: How to connect c# (2.0 Framework [Dotnet 2005]) desktop application with ms sql 2000 Pin
andre_swnpl17-May-07 0:44
andre_swnpl17-May-07 0:44 
GeneralRe: How to connect c# (2.0 Framework [Dotnet 2005]) desktop application with ms sql 2000 Pin
prince_ppy17-May-07 0:48
prince_ppy17-May-07 0:48 

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.