This project is read-only.

All functionality is contained within the DynamicAccess assembly and has XML documentaion present. A summary is repeated here.

 

Direct Static method use:

namespace DynamicAccess
{
/// <summary>
/// static class that holds dynamic accessors
/// </summary>
public static class Accessors
{
/// <summary>
/// Get the dynamic targets member
/// </summary>
/// <param name="target">dynamic target</param>
/// <param name="name">member name</param>
/// <returns>targets member</returns>
public static object GetMember(object target, string name);

/// <summary>
/// Set the dynamic targets member
/// </summary>
/// <param name="target">dynamic target</param>
/// <param name="name">member name</param>
/// <param name="val">value to set</param>
public static void SetMember(object target, string name, object val);

/// <summary>
/// Deletes the dynamic targets member
/// </summary>
/// <param name="target">dynamic target</param>
/// <param name="name">member name</param>
public static void DeleteMember(object target, string name);

/// <summary>
/// Get the dynamic targets index
/// </summary>
/// <param name="target">dynamic target</param>
/// <param name="args">index arguments</param>
/// <returns>targets index value</returns>
public static object GetIndex(object target, params object[] args);

/// <summary>
/// Set the dynamic targets index
/// </summary>
/// <param name="target">dynamic target</param>
/// <param name="args">index arguments and value to set is last argument</param>
public static void SetIndex(object target, params object[] args);
/// <summary>
/// Deletes the dynamic targets index
/// </summary>
/// <param name="target">dynamic target</param>
/// <param name="args">call arguments</param>
/// <returns>nothing</returns>
public static void DeleteIndex(object target, params object[] args);

/// <summary>
/// Call the dynamic target member
/// </summary>
/// <param name="target">dynamic target</param>
/// <param name="name">member name</param>
/// <param name="args">call arguments</param>
/// <returns>call return value</returns>
public static object CallMember(object target, string name, params object[] args);

/// <summary>
/// Call the dynamic target
/// </summary>
/// <param name="target">dynamic target</param>
/// <param name="args">call arguments</param>
/// <returns>call return value</returns>
public static object Call(object target, params object[] args);

/// <summary>
/// Create an instance from the dynamic target
/// </summary>
/// <param name="target">dynamic target</param>
/// <param name="args">constructor arguments</param>
/// <returns>created instance</returns>
public static object CreateInstance(object target, params object[] args);
}
}

 

Dynamic wrapper use:

namespace DynamicAccess
{
/// <summary>
/// Wraps a dynamic object so it can be used by non dynamic languages such as managed C++
/// </summary>
public class DynWrap
{
/// <summary>
/// Constructs a new wrapper
/// </summary>
/// <param name="dynValue">the dynamic value to be wrapped</param>
public DynWrap(dynamic dynValue);

/// <summary>
/// Constructs a new wrapper
/// </summary>
/// <param name="dynValue">the dynamic value to be wrapped</param>
/// <param name="noThrow">if set to false attempts to silently ignore erros</param>
public DynWrap(dynamic dynValue, bool noThrow);

/// <summary>
/// Call the dynamic object
/// </summary>
/// <param name="args">arguments for the call</param>
/// <returns>wrapped return value from call</returns>
public DynWrap C(params object[] args);

/// <summary>
/// Call the dynamic object member function
/// </summary>
/// <param name="name">member name</param>
/// <param name="args">arguments for the call</param>
/// <returns>wrapped return value from call</returns>
public DynWrap CM(string name, params object[] args);

/// <summary>
/// Call the dynamic object member constructor
/// </summary>
/// <param name="args">arguments for the call</param>
/// <returns>the wrapped constructed instance</returns>
public DynWrap CC(params object[] args);

/// <summary>
/// The wrapped dynamic value
/// </summary>
public dynamic V;

/// <summary>
/// Index the wrapped dynamic object
/// </summary>
/// <param name="args">index arguments</param>
/// <returns>wrapped indexed result</returns>
public DynWrap I(params object[] args);

/// <summary>
/// Sets an indexed value on the wrapped dynamic object
/// </summary>
/// <param name="args">index arguments and the value to set as the final item</param>
public void SI(params object[] args);

/// <summary>
/// Remove and indexed value from the wrapped dynamic object
/// </summary>
/// <param name="args">index arguments</param>
public void RI(params object[] args);

/// <summary>
/// Gets the chained members of the wrapped dynamic object
/// ie dw.M("m1", "m2") is equivalent to dw.V.m1.m2
/// </summary>
/// <param name="members">member names</param>
/// <returns>wrapped member result</returns>
public DynWrap M(params object[] members);

/// <summary>
/// Sets the chained members of the wrapped dynamic object
/// </summary>
/// <param name="members">member names and the value to set as the final item</param>
public void SM(params object[] members);

/// <summary>
/// Remove a member from the wrapped dynamic object
/// </summary>
/// <param name="member">member name to remove</param>
public void RM(object member);

/// Various implicit converters
public static implicit operator bool(DynWrap dynWrap);
public static implicit operator sbyte(DynWrap dynWrap);
public static implicit operator Int16(DynWrap dynWrap);
public static implicit operator Int32(DynWrap dynWrap);
public static implicit operator Int64(DynWrap dynWrap);
public static implicit operator byte(DynWrap dynWrap);
public static implicit operator UInt16(DynWrap dynWrap);
public static implicit operator UInt32(DynWrap dynWrap);
public static implicit operator UInt64(DynWrap dynWrap);
public static implicit operator double(DynWrap dynWrap);
public static implicit operator char(DynWrap dynWrap);
public static implicit operator string(DynWrap dynWrap);
public static implicit operator DateTime(DynWrap dynWrap);
}
}

Last edited Dec 28, 2010 at 1:55 AM by hevok, version 2

Comments

No comments yet.