Represents a non-native CLR object instance.
Inheritance: ObjectInstance
Example #1
0
        /// <summary>Creates an instance of ClrInstanceWrapper or ArrayInstance based on object type.</summary>
        /// <param name="engine"></param>
        /// <param name="instance"></param>
        public static ObjectInstance Create(ScriptEngine engine, object instance)
        {
            var instanceAsIEnumerable = instance as System.Collections.IEnumerable;

            if (instanceAsIEnumerable != null)
            {
                var dst        = new System.Collections.ArrayList();
                var enumerator = instanceAsIEnumerable.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    var wrapped = ClrInstanceWrapper.Create(engine, enumerator.Current);
                    dst.Add(wrapped);
                }

                return(engine.Array.New(dst.ToArray()));
            }

            return(new ClrInstanceWrapper(engine, instance));
        }
Example #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="clrInstanceWrapper">The displayed object</param>
 public ClrInstanceWrapperDebugView(ClrInstanceWrapper clrInstanceWrapper)
 {
     this.clrInstanceWrapper = clrInstanceWrapper;
 }