import System
import clr

def CallMethod(obj, i, methodName, args):
    t = clr.GetClrType(i)
    m = t.GetMethod(methodName)
    arr = None
    if args!=None:
        arr = System.Array[object](args)
    return m.Invoke(obj, arr)

def GetPropertyValue(obj, i, propName, args):
    t = clr.GetClrType(i)
    p = t.GetProperty(propName)
    arr = None
    if args!=None:
        arr = System.Array[object](args)
    return p.GetValue(obj, arr)

def SetPropertyValue(obj, i, propName, args, val):
    t = clr.GetClrType(i)
    p = t.GetProperty(propName)
    arr = None
    if args!=None:
        arr = System.Array[object](args)
    return p.SetValue(obj, val, arr)
