Click here to Skip to main content
15,912,400 members
Home / Discussions / C#
   

C#

 
QuestionCheck List Box en C# to select View Schedules in Revit from Visual Studio Pin
Member 145554449-Aug-19 9:44
Member 145554449-Aug-19 9:44 
QuestionParse arithmetics in ONE string, e.g. "2 + 5 x 1024 - (32 x 512 - 16 x 14) + 256"? Pin
arnold_w8-Aug-19 23:49
arnold_w8-Aug-19 23:49 
AnswerRe: Parse arithmetics in ONE string, e.g. "2 + 5 x 1024 - (32 x 512 - 16 x 14) + 256"? Pin
Eddy Vluggen9-Aug-19 0:19
professionalEddy Vluggen9-Aug-19 0:19 
GeneralRe: Parse arithmetics in ONE string, e.g. "2 + 5 x 1024 - (32 x 512 - 16 x 14) + 256"? Pin
arnold_w9-Aug-19 0:43
arnold_w9-Aug-19 0:43 
AnswerRe: Parse arithmetics in ONE string, e.g. "2 + 5 x 1024 - (32 x 512 - 16 x 14) + 256"? Pin
OriginalGriff9-Aug-19 0:34
mveOriginalGriff9-Aug-19 0:34 
GeneralRe: Parse arithmetics in ONE string, e.g. "2 + 5 x 1024 - (32 x 512 - 16 x 14) + 256"? Pin
arnold_w9-Aug-19 0:43
arnold_w9-Aug-19 0:43 
GeneralRe: Parse arithmetics in ONE string, e.g. "2 + 5 x 1024 - (32 x 512 - 16 x 14) + 256"? Pin
OriginalGriff9-Aug-19 0:49
mveOriginalGriff9-Aug-19 0:49 
AnswerRe: Parse arithmetics in ONE string, e.g. "2 + 5 x 1024 - (32 x 512 - 16 x 14) + 256"? Pin
BillWoodruff17-Aug-19 20:01
professionalBillWoodruff17-Aug-19 20:01 
a hack:
DataTable dtable = new DataTable();

public double? EvalExpr(string expr, string filter = "")
{
    dtable.Clear();

    object result;

    try
    {
        result = dtable.Compute(expr, filter);
    }
    catch(Exception ex)
    {
        throw new InvalidOperationException(ex.Message);
    }

    if (result == null) return null;

    return Convert.ToDouble(result);
}
Sample call:
double? result = EvalExpr("((2 + 5) * 1024) - (32 * 512 - 16 * 14) + 256");
See: [^]

Note that a nullable 'double is returned here since the other possible numeric types can be safely cast to 'double. Note the use of 'Convert is required: a simple cast will not work !
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot


modified 18-Aug-19 8:29am.

AnswerRe: Parse arithmetics in ONE string, e.g. "2 + 5 x 1024 - (32 x 512 - 16 x 14) + 256"? Pin
Ashirwad Satapathi19-Aug-19 0:56
professionalAshirwad Satapathi19-Aug-19 0:56 
QuestionNew version of visual studio Pin
Brian_TheLion7-Aug-19 18:55
Brian_TheLion7-Aug-19 18:55 
AnswerRe: New version of visual studio Pin
OriginalGriff7-Aug-19 19:15
mveOriginalGriff7-Aug-19 19:15 
GeneralRe: New version of visual studio Pin
Brian_TheLion7-Aug-19 19:27
Brian_TheLion7-Aug-19 19:27 
AnswerRe: New version of visual studio Pin
Swinkaran11-Aug-19 14:43
professionalSwinkaran11-Aug-19 14:43 
AnswerRe: New version of visual studio Pin
Benktesh Sharma14-Aug-19 2:11
Benktesh Sharma14-Aug-19 2:11 
GeneralRe: New version of visual studio Pin
Brian_TheLion14-Aug-19 17:55
Brian_TheLion14-Aug-19 17:55 
GeneralRe: New version of visual studio Pin
Benktesh Sharma15-Aug-19 2:09
Benktesh Sharma15-Aug-19 2:09 
QuestionC# Get IP Address of Primary NIC - A Question Pin
Kevin Marois7-Aug-19 7:28
professionalKevin Marois7-Aug-19 7:28 
AnswerRe: C# Get IP Address of Primary NIC - A Question Pin
Dave Kreskowiak7-Aug-19 7:31
mveDave Kreskowiak7-Aug-19 7:31 
GeneralRe: C# Get IP Address of Primary NIC - A Question Pin
Kevin Marois7-Aug-19 7:50
professionalKevin Marois7-Aug-19 7:50 
GeneralRe: C# Get IP Address of Primary NIC - A Question Pin
Dave Kreskowiak7-Aug-19 9:41
mveDave Kreskowiak7-Aug-19 9:41 
AnswerRe: C# Get IP Address of Primary NIC - A Question Pin
Randor 9-Aug-19 15:26
professional Randor 9-Aug-19 15:26 
Questionrequest.GetResponse() - The remote server returned an error: (403) Forbidden Pin
_Q12_5-Aug-19 11:53
_Q12_5-Aug-19 11:53 
AnswerRe: request.GetResponse() - The remote server returned an error: (403) Forbidden Pin
Dave Kreskowiak5-Aug-19 12:04
mveDave Kreskowiak5-Aug-19 12:04 
GeneralRe: request.GetResponse() - The remote server returned an error: (403) Forbidden Pin
_Q12_5-Aug-19 12:21
_Q12_5-Aug-19 12:21 
GeneralRe: request.GetResponse() - The remote server returned an error: (403) Forbidden Pin
Eddy Vluggen5-Aug-19 12:35
professionalEddy Vluggen5-Aug-19 12:35 

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.