static void ResolveRefOutArgs(AppFriend app, Type type, object src, out object arg, out ResolveArgument resolveArgument)
 {
     if (type.IsInterface)
     {
         ResolveInterfaceRefOutArgs(app, type, src, out arg, out resolveArgument);
     }
     else if (type == typeof(AppVar))
     {
         ResolveAppVarRefOutArgs(app, type, src, out arg, out resolveArgument);
     }
     else
     {
         var func = UserWrapperUtility.FindCreateConstructor(type);
         if (func != null)
         {
             ResolveUserWrapperRefOutArgs(func, app, src, out arg, out resolveArgument);
         }
         else
         {
             AppVar appVar = app.Dim(src);
             arg = appVar;
             resolveArgument = () => appVar.Core;
         }
     }
 }
 static void ResolveInterfaceRefOutArgs(AppFriend app, Type type, object src, out object arg, out ResolveArgument resolveArgument)
 {
     if (src == null)
     {
         AppVar appVar = app.Dim();
         arg = appVar;
         resolveArgument = () => FriendlyProxyFactory.WrapFriendlyProxyInstance(type, appVar);
     }
     else
     {
         var proxy = RemotingServices.GetRealProxy(src) as IAppVarOwner;
         if (proxy == null)
         {
             AppVar appVar = app.Dim(src);
             arg = appVar;
             resolveArgument = () => FriendlyProxyFactory.WrapFriendlyProxyInstance(type, appVar);
         }
         else
         {
             arg = proxy;
             resolveArgument = () => AppVarUtility.IsNull(proxy.AppVar) ? null : src;
         }
     }
 }
  static string MakeGenericTypeFullName(AppFriend app, string genericTypeFullName, string[] genericArgumentsFullName)
  {
      AppVar typeFinder = app.Dim(new NewInfo("Codeer.Friendly.DotNetExecutor.TypeFinder"));//magic name.
      AppVar genericType = typeFinder["GetType"](genericTypeFullName);
      AppVar genericArguments = app.Dim(new Type[genericArgumentsFullName.Length]);
      for (int i = 0; i < genericArgumentsFullName.Length; i++)
      {
          genericArguments["[]"](i, typeFinder["GetType"](genericArgumentsFullName[i]));
      }
      try
      {
          AppVar type = genericType["MakeGenericType"](genericArguments);
          return (string)type["FullName"]().Core;
      }
      catch (FriendlyOperationException) { }
      return string.Empty;
 
  }
 static void ResolveUserWrapperRefOutArgs(UserWrapperUtility.Construct func, AppFriend app, object src, out object arg, out ResolveArgument resolveArgument)
 {
     if (src == null)
     {
         AppVar appVar = app.Dim();
         arg = appVar;
         resolveArgument = () =>func(appVar);
     }
     else
     {
         arg = src;
         IAppVarOwner owner = src as IAppVarOwner;
         resolveArgument = () => (owner != null && AppVarUtility.IsNull(owner.AppVar)) ? null : src;
     }
 }
 static void ResolveAppVarRefOutArgs(AppFriend app, Type type, object src, out object arg, out ResolveArgument resolveArgument)
 {
     if (src == null)
     {
         AppVar appVar = app.Dim();
         arg = appVar;
         resolveArgument = () => appVar;
     }
     else
     {
         arg = src;
         resolveArgument = () => src;
     }
 }