Click here to Skip to main content
15,891,951 members
Home / Discussions / C#
   

C#

 
AnswerRe: RegEx help for a RegEx Newb Pin
Skippums4-Sep-07 12:12
Skippums4-Sep-07 12:12 
QuestionC# Generics - Using operators with generic objects Pin
funkymint4-Sep-07 4:28
funkymint4-Sep-07 4:28 
AnswerRe: C# Generics - Using operators with generic objects Pin
Christian Graus4-Sep-07 4:43
protectorChristian Graus4-Sep-07 4:43 
GeneralRe: C# Generics - Using operators with generic objects Pin
funkymint4-Sep-07 4:54
funkymint4-Sep-07 4:54 
GeneralRe: C# Generics - Using operators with generic objects Pin
DavidNohejl4-Sep-07 6:09
DavidNohejl4-Sep-07 6:09 
AnswerRe: C# Generics - Using operators with generic objects Pin
Urs Enzler4-Sep-07 4:55
Urs Enzler4-Sep-07 4:55 
GeneralRe: C# Generics - Using operators with generic objects [modified] Pin
funkymint4-Sep-07 5:32
funkymint4-Sep-07 5:32 
GeneralRe: C# Generics - Using operators with generic objects Pin
funkymint4-Sep-07 5:51
funkymint4-Sep-07 5:51 
How about if I created a function which takes operands of type Object and then calls other overloaded functions:

public bool getOperatorResult(string operatorType, System.Object operandA, System.Object operandB)
        {
            if (operandA is bool)
            {
                return getOperatorResult(operatorType, (bool)operandA, (bool)operandB);
            }
            else if (operandA is double)
            {
                return getOperatorResult(operatorType, (double)operandA, (double)operandB);
            }
            else if (operandA is int)
            {
                return getOperatorResult(operatorType, (int)operandA, (int)operandB);
            }
            else if (operandA is long)
            {
                return getOperatorResult(operatorType, (long)operandA, (long)operandB);
            }
            else if (operandA is string)
            {
                return getOperatorResult(operatorType, (string)operandA, (string)operandB);
            }
            else
            {
                return false;
            }
        }


public bool getOperatorResult(string operatorType, bool operandA, bool operandB)
        {
            switch (operatorType)
            {
                case "or":
                    return (operandA || operandB);
                case "and":
                    return (operandA && operandB);
                case "equal":
                    return (operandA == operandB);
                case "notequal":
                    return (operandA != operandB);
                default:
                    return false;
            }
        }

GeneralRe: C# Generics - Using operators with generic objects Pin
Christian Graus4-Sep-07 6:06
protectorChristian Graus4-Sep-07 6:06 
AnswerRe: C# Generics - Using operators with generic objects Pin
Skippums4-Sep-07 12:47
Skippums4-Sep-07 12:47 
QuestionSerialized objects [modified] Pin
jblouir4-Sep-07 4:15
jblouir4-Sep-07 4:15 
AnswerRe: Serialized objects Pin
led mike4-Sep-07 5:53
led mike4-Sep-07 5:53 
GeneralRe: Serialized objects Pin
jblouir4-Sep-07 5:56
jblouir4-Sep-07 5:56 
Questionhow to import a dll Pin
lune124-Sep-07 4:04
lune124-Sep-07 4:04 
AnswerRe: how to import a dll Pin
N a v a n e e t h4-Sep-07 4:08
N a v a n e e t h4-Sep-07 4:08 
AnswerRe: how to import a dll Pin
Christian Graus4-Sep-07 4:10
protectorChristian Graus4-Sep-07 4:10 
GeneralRe: how to import a dll Pin
lune124-Sep-07 4:45
lune124-Sep-07 4:45 
GeneralRe: how to import a dll Pin
Christian Graus4-Sep-07 5:08
protectorChristian Graus4-Sep-07 5:08 
QuestionTWAIN Implementation/Capabilities in C# .net Pin
gruberdominik4-Sep-07 3:59
gruberdominik4-Sep-07 3:59 
Questionobject to string[] Pin
Glen Harvy4-Sep-07 3:52
Glen Harvy4-Sep-07 3:52 
AnswerRe: object to string[] Pin
originSH4-Sep-07 3:57
originSH4-Sep-07 3:57 
GeneralRe: object to string[] Pin
Glen Harvy4-Sep-07 4:24
Glen Harvy4-Sep-07 4:24 
QuestionObject disposing and using keyword Pin
N a v a n e e t h4-Sep-07 3:42
N a v a n e e t h4-Sep-07 3:42 
AnswerRe: Object disposing and using keyword Pin
Christian Graus4-Sep-07 3:47
protectorChristian Graus4-Sep-07 3:47 
GeneralRe: Object disposing and using keyword Pin
N a v a n e e t h4-Sep-07 3:59
N a v a n e e t h4-Sep-07 3:59 

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.