Source/NFX/Environment/Behavior.cs
/// <summary>
/// Applies behaviors as declared using attributes on target isntance's type
/// </summary>
Applies behaviors as declared using attributes on target isntance's type
Applies behaviors as declared using attributes on target isntance ' s type
public static void ApplyBehaviorAttributes(object target)
          {
                var tp = target.GetType();
                while(tp!=null)
                {
                    var attrs = tp.GetCustomAttributes(typeof(Behavior), false).Cast<Behavior>().OrderBy(b => b.m_Order);
                    foreach(var behavior in attrs)
                        behavior.Apply(target);
                    tp = tp.BaseType;
                }
          }
public static void ApplyBehaviorAttributes ( object target ) { var tp = target . GetType ( ) ; while ( tp != null ) { var attrs = tp . GetCustomAttributes ( typeof ( Behavior ) , false ) . Cast < Behavior > ( ) . OrderBy ( b => b . m_Order ) ; foreach ( var behavior in attrs ) behavior . Apply ( target ) ; tp = tp . BaseType ; } }
Applies behaviors as declared using attributes on target isntance's type
Applies behaviors as declared using attributes on target isntance ' s type
target
object