Tests/UnitTestImpromptuInterface/SingleMethodInvoke.cs
/// <summary>
/// To dynamically invoke a method with out or ref parameters you need to know the signature
/// </summary>
To dynamically invoke a method with out or ref parameters you need to know the signature
To dynamically invoke a method with out or ref parameters you need to know the signature
[Test]
        public void TestOutMethod()
        {
            string tResult = String.Empty;
            var tPoco = new MethOutPoco();
            var tName = "Func";
            var tContext = GetType();
            var tBinder =
                Binder.InvokeMember(BinderFlags.None, tName, null, tContext,
                                            new[]
                                                {
                                                    Info.Create(
                                                        InfoFlags.None, null),
                                                    Info.Create(
                                                        InfoFlags.IsOut |
                                                        InfoFlags.UseCompileTimeType, null)
                                                });
            var tSite = Dynamic.CreateCallSite<DynamicTryString>(tBinder, tName, tContext);
            tSite.Target.Invoke(tSite, tPoco, out tResult);
            Assert.AreEqual("success", tResult);
        }
[ Test ] public void TestOutMethod ( ) { string tResult = String . Empty ; var tPoco = new MethOutPoco ( ) ; var tName = " " ; var tContext = GetType ( ) ; var tBinder = Binder . InvokeMember ( BinderFlags . None , tName , null , tContext , new [ ] { Info . Create ( InfoFlags . None , null ) , Info . Create ( InfoFlags . IsOut | InfoFlags . UseCompileTimeType , null ) } ) ; var tSite = Dynamic . CreateCallSite < DynamicTryString > ( tBinder , tName , tContext ) ; tSite . Target . Invoke ( tSite , tPoco , out tResult ) ; Assert . AreEqual ( " " , tResult ) ; }
To dynamically invoke a method with out or ref parameters you need to know the signature
To dynamically invoke a method with out or ref parameters you need to know the signature