当前位置: 首页>>代码示例>>C#>>正文


C# Message.AssignFrom方法代码示例

本文整理汇总了C#中Message.AssignFrom方法的典型用法代码示例。如果您正苦于以下问题:C# Message.AssignFrom方法的具体用法?C# Message.AssignFrom怎么用?C# Message.AssignFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Message的用法示例。


在下文中一共展示了Message.AssignFrom方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AssignInvalidData

        public void AssignInvalidData()
        {
            var name = "field";
            var m = new Message("topic");

            try
            {
                m.AssignFrom(name, new object[] { 1, 2, "invalid" });
                Assert.Fail("Invalid elements should throw Exception");
            }
            catch (BinTypeMismatchException)
            {
                // ok!
            }
        }
开发者ID:velcrome,项目名称:vvvv-Message,代码行数:15,代码来源:MessageTest.cs

示例2: AssignContainingNullTyped

        public void AssignContainingNullTyped()
        {
            var name = "field";
            var m = new Message("topic");

            try
            {
                m.AssignFrom(name, new object[] { 1, 2, null }, typeof(int));
                Assert.Fail("Invalid elements should throw Exception");
            }
            catch (ArgumentNullException)
            {
                // ok!
            }
        }
开发者ID:velcrome,项目名称:vvvv-Message,代码行数:15,代码来源:MessageTest.cs

示例3: AssignFromTest

        public void AssignFromTest()
        {
            var name = "field";
            var m = new Message("topic");
            m.Commit(this);

            Assert.IsFalse(m.IsChanged);
            var data = Enumerable.Repeat(4, 4);
            m.AssignFrom(name, data);

            Assert.IsTrue(m.IsChanged);

            Assert.AreEqual(m[name], BinFactory.New(4, 4, 4, 4));
            Assert.AreEqual(m[name].Count, 4);
        }
开发者ID:velcrome,项目名称:vvvv-Message,代码行数:15,代码来源:MessageTest.cs

示例4: Evaluate

        public override void Evaluate(int SpreadMax)
        {
            InitDX11Graph();

            bool warnPinSafety = false;
            if (RemovePinsFirst) warnPinSafety = !RetryConfig();

            if (!FNew.Any()) // if none true
            {
                FOutput.FlushNil();
                return;
            }

            SpreadMax = FNew.CombineWith(FTopic);
            foreach (string name in FPins.Keys)
            {
                var pin = FPins[name].ToISpread();
                pin.Sync();
                SpreadMax = Math.Max(pin.SliceCount, SpreadMax);
            }

            FOutput.SliceCount = 0;
            for (int i = 0; i < SpreadMax; i++)
            {

                if (FNew[i])
                {
                    var message = new Message();

                    message.Topic = FTopic[i];
                    foreach (string name in FPins.Keys)
                    {
                        var pin = FPins[name].ToISpread();
                        if (pin.SliceCount > 0)
                            message.AssignFrom(name, pin[i] as ISpread);
                        else message[name] = BinFactory.New(Formular[name].Type); // will do empty spreads as well, but ignore faults
                    }
                    FOutput.Add(message);
                }
            }
            FOutput.Flush();

            if (warnPinSafety)
                throw new PinConnectionException("Manually remove unneeded links first! [Create]. ID = [" + PluginHost.GetNodePath(false) + "]");
        }
开发者ID:velcrome,项目名称:vvvv-Message,代码行数:45,代码来源:MessageCreateNode.cs

示例5: AssignStartingWithNull

        public void AssignStartingWithNull()
        {
            var name = "field";
            var m = new Message("topic");

            try
            {
                m.AssignFrom(name, new object[] { null, 2, 3 });
                Assert.Fail("Invalid elements should throw Exception");
            }
            catch (ArgumentNullException)
            {
                // ok!
            }
        }
开发者ID:velcrome,项目名称:vvvv-Message,代码行数:15,代码来源:MessageTest.cs

示例6: AssignNull

        public void AssignNull()
        {
            var name = "field";
            var m = new Message("topic");

            try
            {
                m.AssignFrom(name, null);
                Assert.Fail("Assigning null should throw Exception");
            }
            catch (ArgumentNullException)
            {
                // ok!
            }
        }
开发者ID:velcrome,项目名称:vvvv-Message,代码行数:15,代码来源:MessageTest.cs

示例7: AssignInvalidType

        public void AssignInvalidType()
        {
            var name = "field";
            var m = new Message("topic");

            try
            {
                m.AssignFrom(name, new object[] { new object(), 2, 3 });
                Assert.Fail("Invalid elements should throw Exception");
            }
            catch (TypeNotSupportedException)
            {
                // ok!
            }
        }
开发者ID:velcrome,项目名称:vvvv-Message,代码行数:15,代码来源:MessageTest.cs

示例8: AssignInvalidName

        public void AssignInvalidName()
        {
            var name = "this fails";
            var m = new Message("topic");

            try
            {
                m.AssignFrom(name, Enumerable.Repeat(4, 4), typeof(int));
                Assert.Fail("Invalid Names should throw Exception");
            }
            catch (ParseFormularException)
            {
                // ok!
            }
        }
开发者ID:velcrome,项目名称:vvvv-Message,代码行数:15,代码来源:MessageTest.cs


注:本文中的Message.AssignFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。