Expression Trees

  • ‘tree like’ data structure
  • each node is expression (method call, equality comparison, binary operation etc.) representing a piece of code
  • you can compile expression tree and run code it represent
  • enables dynamic code generation at runtime
  • LINQ queries on DBs are implemented with Expression Trees
  • used in the dynamic language runtime (DLR)
  • anonymous lambda expression can be converted to ExpressionTree via compiler (i.e. x => x*2 can be represented as tree instead of delegate or anonymous lambda function)

Further read:

https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/expression-trees/

Automatic scrolling to edited text box in Xamarin Android.

Important note: this should work well with newer version of Xamarin (2.3.3). If you cannot update for some reason this article will explain workaround.

Introduction

In previous article I explained how to detect show and hide events of software keyboard in Xamarin Android. I did it in my project because of the fact that some of text boxes was hidden by software keyboard that suppose to edit contents of those text boxes. In this article I will explain how to work around this issue in some older versions of Xamarin. Continue reading “Automatic scrolling to edited text box in Xamarin Android.”

Genereting proxies during runtime using Reflection.Emit

Reflection.Emit is very powerful tool. It creates IL code and since C# is converted into IL too, we have the same functionality as in C# and even more. It is very powerful and at the same time very complicated. Because of that it is worth to discuss how and for what it should be used. One idea is to create dynamic code with automatic implementations of interfaces – proxy types.

Continue reading “Genereting proxies during runtime using Reflection.Emit”