ToWoopsaValue() public static method

public static ToWoopsaValue ( object value, WoopsaValueType type, System.DateTime timeStamp = null ) : WoopsaValue
value object
type WoopsaValueType
timeStamp System.DateTime
return WoopsaValue
コード例 #1
0
        public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
        {
            result = null;
            foreach (var method in InnerObject.Methods)
            {
                if (method.Name.Equals(binder.Name))
                {
                    var argumentInfos = method.ArgumentInfos.ToArray();

                    var arguments = new IWoopsaValue[argumentInfos.Length];
                    for (int i = 0; i < argumentInfos.Length; i++)
                    {
                        WoopsaValueType woopsaValueType;
                        WoopsaConverter woopsaConverter;
                        if (CustomTypeConverters != null)
                        {
                            CustomTypeConverters.InferWoopsaType(args[i].GetType(), out woopsaValueType, out woopsaConverter);
                            arguments[i] = woopsaConverter.ToWoopsaValue(args[i], woopsaValueType, null);
                        }
                        else
                        {
                            arguments[i] = WoopsaValue.ToWoopsaValue(args[i], argumentInfos[i].Type);
                        }
                    }
                    result = method.Invoke(arguments);
                    return(true);
                }
            }
            return(false);
        }
コード例 #2
0
 public override bool TrySetMember(SetMemberBinder binder, object value)
 {
     foreach (var property in InnerObject.Properties)
     {
         if (binder.Name.Equals(property.Name))
         {
             property.Value = WoopsaValue.ToWoopsaValue(value, property.Type);
             return(true);
         }
     }
     return(false);
 }
コード例 #3
0
 public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
 {
     result = null;
     foreach (var method in InnerObject.Methods)
     {
         if (method.Name.Equals(binder.Name))
         {
             var argumentInfos = method.ArgumentInfos.ToArray();
             var arguments     = new IWoopsaValue[argumentInfos.Length];
             for (int i = 0; i < argumentInfos.Length; i++)
             {
                 arguments[i] = WoopsaValue.ToWoopsaValue(args[i], argumentInfos[i].Type);
             }
             result = method.Invoke(arguments);
             return(true);
         }
     }
     return(false);
 }
コード例 #4
0
 public override WoopsaValue ToWoopsaValue(object value, WoopsaValueType woopsaValueType,
                                           DateTime?timeStamp)
 {
     return(WoopsaValue.ToWoopsaValue(value, woopsaValueType, timeStamp));
 }