Create New Expression from Existing Expression?

Yes, that's exactly what you want - and using Expression. Property is the easiest way to do that: Expression func = Expression. Property(existingFunc.

Body, "Month"); Expression> lambda = Expression. Lambda>(func, existingFunc. Parameters) I believe that should be okay.It works in this simple test: using System; using System.Linq.

Expressions; class Person { public DateTime Birthday { get; set; } } class Test { static void Main() { Person jon = new Person { Birthday = new DateTime(1976, 6, 19) }; Expression> dateTimeExtract = p => p. Birthday; var monthExtract = ExtractMonth(dateTimeExtract); var compiled = monthExtract.Compile(); Console. WriteLine(compiled(jon)); } static Expression> ExtractMonth (Expression> existingFunc) { Expression func = Expression.

Property(existingFunc. Body, "Month"); Expression> lambda = Expression. Lambda>(func, existingFunc.

Parameters); return lambda; } }.

Yes, that's exactly what you want - and using Expression. Property is the easiest way to do that: Expression func = Expression. Property(existingFunc.

Body, "Month"); Expression> lambda = Expression. Lambda>(func, existingFunc. Parameters); I believe that should be okay.It works in this simple test: using System; using System.Linq.

Expressions; class Person { public DateTime Birthday { get; set; } } class Test { static void Main() { Person jon = new Person { Birthday = new DateTime(1976, 6, 19) }; Expression> dateTimeExtract = p => p. Birthday; var monthExtract = ExtractMonth(dateTimeExtract); var compiled = monthExtract.Compile(); Console. WriteLine(compiled(jon)); } static Expression> ExtractMonth (Expression> existingFunc) { Expression func = Expression.

Property(existingFunc. Body, "Month"); Expression> lambda = Expression. Lambda>(func, existingFunc.

Parameters); return lambda; } }.

Worked perfectly. Thank you Jon. – Adam Mar 4 '10 at 7:33.

Expression func = Expression. Lambda>(func, existingFunc. Expression> dateTimeExtract = p => p.

Expression func = Expression. Lambda>(func, existingFunc.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions