public static void BindAttributes(ofElement element) { if (element == null) { return; } var type = element.GetType(); if (_binder.TryGetValue(type, out var binder)) { binder(element); return; } var x = Expression.Parameter(typeof(ofElement)); var y = Expression.Variable(type, nameof(element)); binder = Expression.Lambda <Action <ofElement> >( Expression.Block(new[] { y }, Expression.Assign(y, Expression.Convert(x, type)), BuildBinder(type, y)), x) .CompileSafe(); (_binder[type] = binder)(element); }
bool CanRender(ofElement element) { if (element == null) { return(false); } if (Element == null || ReferenceEquals(element, Element)) { return(true); } return(element.GetType() == Element.GetType() && KeysEqual(element, Element)); }