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


C# SimpleClass类代码示例

本文整理汇总了C#中SimpleClass的典型用法代码示例。如果您正苦于以下问题:C# SimpleClass类的具体用法?C# SimpleClass怎么用?C# SimpleClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetClone_Class_Cloned

 public void GetClone_Class_Cloned()
 {
     var source = new SimpleClass() { Property = 10, _field = 3 };
     var target = CloneFactory.GetClone(source);
     Assert.AreEqual(source.Property, target.Property);
     Assert.AreEqual(source._field, target._field);
 }
开发者ID:CodeDux,项目名称:CloneExtensions,代码行数:7,代码来源:ComplexTypeTests.cs

示例2: Main

    public static void Main()
    {
        SimpleStruct ss = new SimpleStruct();
        ss.X = 5;
        ss.DisplayX();

        SS si = (SS) ss;
        si.X = 90;
        si.DisplayX();
        
        ss =  (SimpleStruct) si ;
        ss.X = 5;
        ss.DisplayX();
        
        SimpleClass ss1 = new SimpleClass();
        ss1.X = 5;
        ss1.DisplayX();
        
        try {
        ss1 =  (SimpleClass) si ;
        ss1.X = 5;
        ss1.DisplayX();
        } 
        catch(Exception)
        {
        	Console.WriteLine("Failed to cast");
        }
        

    }
开发者ID:mortezabarzkar,项目名称:SharpNative,代码行数:30,代码来源:StructInterfaceTest.cs

示例3: delegate_test_class

    public static SimpleClass delegate_test_class(SimpleClass
ss)
    {
        if
        (ss
        ==
        null)
        return
        null;
        if
        (!
        (!ss.a
        &&
        ss.b
        &&
        !ss.c
        &&
        ss.d
        ==
        "TEST"))
        return
        null;
        SimpleClass
        res
        =
        ss;
        return
        res;
    }
开发者ID:robertmichaelwalsh,项目名称:CSharpFrontEnd,代码行数:29,代码来源:pinvoke3.cs

示例4: CrossoverTest

        public void CrossoverTest()
        {
            var obj = new SimpleClass();
            var generator = new Generator<SimpleClass>();
            CodeExpression<SimpleClass> leftTree = generator.BuildRandomExpressionTree();
            CodeExpression<SimpleClass> rightTree = generator.BuildRandomExpressionTree();

            Trace.WriteLine("Vor dem Crossover");
            Trace.WriteLine("-----------------");
            Trace.WriteLine("");
            Trace.WriteLine("Tree links:");
            Trace.WriteLine(leftTree);

            Trace.WriteLine("");
            Trace.WriteLine("Tree rechts:");
            Trace.WriteLine(rightTree);

            generator.Crossover(ref leftTree, ref rightTree);

            Trace.WriteLine("");
            Trace.WriteLine("Nach dem Crossover");
            Trace.WriteLine("------------------");
            Trace.WriteLine("");
            Trace.WriteLine("Tree links:");
            Trace.WriteLine(leftTree);

            Trace.WriteLine("");
            Trace.WriteLine("Tree rechts:");
            Trace.WriteLine(rightTree);
        }
开发者ID:sunsided,项目名称:maze-evolution,代码行数:30,代码来源:ExpressionTreeTest.cs

示例5: TestSimpleObject

 public void TestSimpleObject()
 {
     var nodeContainer = new NodeContainer();
     var instance = new SimpleClass { Member1 = 3, Member2 = new SimpleClass() };
     var rootNode = nodeContainer.GetOrCreateNode(instance);
     var visitor = new TestVisitor();
     visitor.Visit(rootNode);
     var expectedNodes = new[]
     {
         rootNode,
         rootNode.TryGetChild(nameof(SimpleClass.Member1)),
         rootNode.TryGetChild(nameof(SimpleClass.Member2)),
         rootNode.TryGetChild(nameof(SimpleClass.Member2)).Target,
         rootNode.TryGetChild(nameof(SimpleClass.Member2)).Target.TryGetChild(nameof(SimpleClass.Member1)),
         rootNode.TryGetChild(nameof(SimpleClass.Member2)).Target.TryGetChild(nameof(SimpleClass.Member2)),
     };
     var expectedPaths = new[]
     {
         new GraphNodePath(rootNode),
         new GraphNodePath(rootNode).PushMember(nameof(SimpleClass.Member1)),
         new GraphNodePath(rootNode).PushMember(nameof(SimpleClass.Member2)),
         new GraphNodePath(rootNode).PushMember(nameof(SimpleClass.Member2)).PushTarget(),
         new GraphNodePath(rootNode).PushMember(nameof(SimpleClass.Member2)).PushTarget().PushMember(nameof(SimpleClass.Member1)),
         new GraphNodePath(rootNode).PushMember(nameof(SimpleClass.Member2)).PushTarget().PushMember(nameof(SimpleClass.Member2)),
     };
     VerifyNodesAndPath(expectedNodes, expectedPaths, visitor);
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:27,代码来源:TestGraphVisitor.cs

示例6: CopyTo

		public void CopyTo()
		{
			ViewFactory<SimpleClass> factory = ViewFactory<SimpleClass>.IList();
			IList<SimpleClass> list = factory.List;

			list.Add(new SimpleClass(100, "aaa", new DateTime(1970, 1, 1)));
			list.Add(new SimpleClass(80, "bbb", new DateTime(1980, 12, 12)));
			list.Add(new SimpleClass(60, "ccc", new DateTime(1975, 6, 6)));

			SimpleClass[] array = new SimpleClass[3];
			((ICollection)factory.View).CopyTo(array, 0);

			SimpleClass item = array[0];
			Assert.IsNotNull(item);
			Assert.AreEqual(100, item.IntegerValue);
			Assert.AreEqual("aaa", item.StringValue);
			Assert.AreEqual(new DateTime(1970, 1, 1), item.DateTimeValue);

			item = array[1];
			Assert.AreEqual(80, item.IntegerValue);
			Assert.AreEqual("bbb", item.StringValue);
			Assert.AreEqual(new DateTime(1980, 12, 12), item.DateTimeValue);

			item = array[2];
			Assert.AreEqual(60, item.IntegerValue);
			Assert.AreEqual("ccc", item.StringValue);
			Assert.AreEqual(new DateTime(1975, 6, 6), item.DateTimeValue);
		}
开发者ID:jayhopeter,项目名称:ObjectListView,代码行数:28,代码来源:ICollection.cs

示例7: ToViewModel_Simple_Class

        public void ToViewModel_Simple_Class()
        {
            var model = new SimpleClass { A = 5, B = "test" };

            var json = Knockout.ToViewModel(model);

            Assert.AreEqual("{\"A\":ko.observable(5),\"B\":ko.observable(\"test\")}", json.ToJson());
        }
开发者ID:paultyng,项目名称:FluentJson.NET,代码行数:8,代码来源:Knockout+Tests.cs

示例8: TestExecuteMethod

        public void TestExecuteMethod()
        {
            SimpleClass simpleClass = new SimpleClass();
            Assert.IsFalse(simpleClass.MethodCalled);

            ReflectionUtilities.ExecuteMethod(simpleClass, "MyMethod");
            Assert.IsTrue(simpleClass.MethodCalled);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:8,代码来源:TestReflectionUtilities.cs

示例9: Main

		static void Main (string[] args)
		{
			var v = ObjCRuntime.Dlfcn.dlopen (GetCurrentExecutingDirectory () + "/SimpleClass.dylib", 0);

			NSApplication.Init ();
			SimpleClass c = new SimpleClass ();
			Console.WriteLine (c.DoIt());
		}
开发者ID:RangoLee,项目名称:mac-samples,代码行数:8,代码来源:SimpleTest.cs

示例10: BuildNullObject6

        public void BuildNullObject6()
        {
            UnityContainer uc = new UnityContainer();
            SimpleClass myObject = new SimpleClass();
            uc.BuildUp(myObject, String.Empty);

            Assert.AreNotEqual(uc.Resolve<SimpleClass>(), myObject);
        }
开发者ID:CFMITL,项目名称:unity,代码行数:8,代码来源:ContainerBuildUpFixture.cs

示例11: I_want_some_nifty_helpers_to_make_generics_useful

        public void I_want_some_nifty_helpers_to_make_generics_useful()
        {
            SimpleClass testClass = new SimpleClass();

            SingleGenericClass<Guid> single = new SingleGenericClass<Guid>(Guid.NewGuid());
            DoubleGenericClass<SingleGenericClass<Guid>, Guid> argument = new DoubleGenericClass<SingleGenericClass<Guid>, Guid>(single, single.Key);

            Generic.Call(testClass, x => x.DoubleGenericMethod<object, object>(null), argument);
        }
开发者ID:KevM,项目名称:Magnum,代码行数:9,代码来源:Generic_Specs.cs

示例12: GenerateExpressionTree

        public void GenerateExpressionTree()
        {
            var obj = new SimpleClass();
            var generator = new Generator<SimpleClass>();
            var func = generator.BuildRandomExpressionTree();
            Trace.WriteLine(func);

            func.Execute(obj);
        }
开发者ID:sunsided,项目名称:maze-evolution,代码行数:9,代码来源:ExpressionTreeTest.cs

示例13: TestExecuteMethod_WithReturnValue

        public void TestExecuteMethod_WithReturnValue()
        {
            SimpleClass simpleClass = new SimpleClass();
            Assert.IsFalse(simpleClass.MethodCalled);

            var returnValue = ReflectionUtilities.ExecuteMethod(simpleClass, "MyMethodWithReturn");
            Assert.IsTrue(simpleClass.MethodCalled);
            Assert.IsTrue(Convert.ToBoolean(returnValue));
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:9,代码来源:TestReflectionUtilities.cs

示例14: GetBindingInstance_should_return_instance_specified_through_SetBindingInstance

        public void GetBindingInstance_should_return_instance_specified_through_SetBindingInstance()
        {
            var scenarioContext = CreateScenarioContext();

            var expectedInstance = new SimpleClass();
            scenarioContext.SetBindingInstance(typeof(SimpleClass), expectedInstance);
            var result = scenarioContext.GetBindingInstance(typeof(SimpleClass));
            result.Should().Be(expectedInstance);
        }
开发者ID:ethanmoffat,项目名称:SpecFlow,代码行数:9,代码来源:ScenarioContext_BindingInstancesTest.cs

示例15: PacksDefinedClassCorrectly

            public void PacksDefinedClassCorrectly()
            {
                var toPack = new SimpleClass {A = true};
                var expected = new List<byte> {0xA1, 0x81, 0x41, (byte) Markers.True}; //1 fields


                var actual = Packers.Map.Pack(toPack);
                actual.Should().Equal(expected);
            }
开发者ID:cskardon,项目名称:Neo4jClient.Ndp,代码行数:9,代码来源:ObjectPackerTests.cs


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