expression

Expression Versus Statement

I'm asking with regards to c#, but I assume its the same in most other languages. Does anyone have a good definition of expressions and statements and what the differences are. Thanks in advance. ...

What are some instances in which expression trees are useful?

I completely understand the concept of expression trees but am having a hard time trying to find situations in which they are useful. Is there a specific instance in which expression trees can be applied? Or is it only useful as a transport mechanism for code? I feel like I am missing something here. Thanks! ...

Boolean Expressions in Shell Scripts

What's the "right" way to do the following as a boolean expression? for i in `ls $1/resources`; do if [ $i != "database.db" ] then if [ $i != "tiles" ] then if [ $i != "map.pdf" ] then if [ $i != "map.png" ] then svn export -q $1/resources/$i ../MyProject/Resources/$i ... ...

Is knowing blend required?

Do you expect your WPF developers to know expression blend? Any good resources for learning more about Blend? [UPDATE] Does knowing blend make you more productive? ...

Combine multiple LINQ expressions from an array

I'm trying to combine a list of functions like so. I have this: Func<int, bool>[] criteria = new Func<int, bool>[3]; criteria[0] = i => i % 2 == 0; criteria[1] = i => i % 3 == 0; criteria[2] = i => i % 5 == 0; And I want this: Func<int, bool>[] predicates = new Func<int, bool>[3]; predicates[0] = i => i % 2 == 0; predicates[1] = i =...

How to embed a png in an Adobe Illustrator or Expression Design file to create XAML

I have an AI file. I paste it into Expression Blend and then export the XAML for use in my WPF project. Works for most of my files, but some export the XAML plus a seperate png file. What can I do so that the png is embedded into the paths of my image and not a seperate image? Can it be done? ...

ExpressionType.Quote

What is the purpose of this UnaryExpression, and how should it be used? ...

When an Expression<T> is compiled, is it implicitly cached?

When an Expression<T> is compiled, is the resultant code implicitly cached by the framework? I'm thinking along the lines of the static Regex methods where the framework implicitly compiles and caches the last few regexes. If compiled Expression<T> objects are not cached, can you recommend some best practices for keeping the compile-tim...

Is it OK to use assignments in expressions?

I came across this code and wanted others to provide their point of view... is it good or bad ? ;) Class ReportClass { public string ReportName {get; set;} } Then it was used as follows in code: displayReport(ReportClass.ReportName = cmbReportName.SelectedValue.ToString()) That is about the simplest form example I can give you. Qu...

Changing the StartPoint/EndPoint of a LinearGradient brush in Expression Blend UI

Seems like as really simple thing to do, but I just can't track it down in the help or online. I know how to change the XAML to set the StartPoint and EndPoint of a LinearGradient brush, but I don't know how you do it using the IDE in Expression Blend - does anyone know the keyboard/mouse actions that you use to do this? ...

How to implement design time validations for XAML, that result in compile errors?

How to enforce that developers writing XAML in Visual Studio should follow certain standards and validations need to be run and if invalid compile time errors are thrown. For example, making sure that all the databinding expressions (some are real long) are written correctly as per 'a custom validation' I would like implement, during de...

Error installing expression web 2 (-2147024873)

Anybody ever had the error "Installation of the "Microsoft Expression Web 2" product has reported the following error: -2147024873.. " when trying to install Microsoft Expression Web 2 or Microsoft Expression Studio? This is the error I'm getting, but I can't figure out what the problem is. I have no beta or RC or pre beta software ins...

How do I compile an Expression Tree into a callable method, C# ?

Hi, I have an expression tree I have created by parsing an Xml using the expression class in C#. See this question. I only have Add, Subtract, Divide, Multiply, Parameters, And and Or in my Expression Tree. Is there a way to convert this ExpressionTree into a callable method? ...or do I have to emit the IL manually? Kind regards, ...

Dynamic logical expression parsing/evaluation in C# or VB?

What is the best was to evaluate an expression like the following: (A And B) Or (A And C) Or (Not B And C) or (A && B) || (A && C) || (!B && C) At runtime, I was planning on converting the above expressions to the following: (True And False) Or (True And False) Or (Not False And True) or (True && False) || (True && False) || (! False ...

Excel-like expressions in DataGridView

In Excel I can use an expression like "=C16+C17" for a cell to display values from other cells. In my application I need something similar. The user needs to be able to select a range of cells from a databound grind and display the sum in another cell (not in a footer!). So what I need is the ability to assign something like "Take the ...

SQL expression problem

Below is my table, a User could have multiple profiles in certain languages, non-English profiles have a higher priority. +----------+--------+----------------+----------------+ |ProfileID |UserID |ProfileLanguage |ProfilePriority | +----------+--------+----------------+----------------+ |1 |1 |en-US |2 ...

How C# Compiler choose SelectMany when translating LINQ expression?

There are 4 overloaded signatures for Enumerable.SelectMany. To make it simple, we ignore the two signatures with int argument. So we have 2 signatures for SelectMany: public static IEnumerable<TResult> SelectMany<TSource, TResult>( this IEnumerable<TSource> source, Func<TSource, IEnumerable<TResult>> selector ) public static I...

How to set more than 2 Expression in Expression.Or

I want to create a query which has more than 3-4 Expression.Or ? But Expression.Or just let me to add two Expressions inside it. if (!string.IsNullOrEmpty(keyword)) query .Add(Expression.Or( Expression.Like("Name", keyword, MatchMode.Anywhere), ...

linq to sql case query

Im having problems building a query with the linq to sql data query expression in c#. What I'm trying to ultimately do is based on this pseudo-code expression. public IQueryable<CTest> searchRecords(string category, string searchString, DateTime startDate, DateTime endDate, int searchType, int searchType2) { //-Sear...

How can I remove middle initial with a dot at the end?

I've got a bunch of first names in a field that carry a middle initial with a '.' at the end..I need a regex to convert this example:Kenneth R.intoKennethI was trying to build my own and found this useful site btw..http://www.gskinner.com/RegExr/but I'm new to Perl & regular expressions and could only get "...$" - which is useless when t...