• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ClassA类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Contains_ReturnsFalse_ForObjectNotInCache

 public void Contains_ReturnsFalse_ForObjectNotInCache()
 {
     var objA = new ClassA();
     var objB = new ClassA();
     cache.Add(objA);
     Assert.IsFalse(cache.Contains(objB));
 }
开发者ID:RobSmyth,项目名称:nserializer,代码行数:7,代码来源:ValuesCacheTests.cs


示例2: AnnotateNonOwnedProperty

 public void AnnotateNonOwnedProperty()
 {
     var targetA = new ClassA();
     var targetB = new ClassB();
     targetA.Annotate(() => targetB.FirstName, Suffix => "Mr");
     Assert.AreEqual("Mr", targetA.Annotation<string>(() => targetB.FirstName, "Suffix"));
 }
开发者ID:tiwariritesh7,项目名称:devdefined-tools,代码行数:7,代码来源:AnnotationTests.cs


示例3: SingleIndexWithMultipleTypes

        public void SingleIndexWithMultipleTypes()
        {
            var data = Enumerable.Range(0, 100)
                .Select(i =>
                {
                    MyBaseClass o = null;
                    if (i % 2 == 0)
                        o = new ClassA() { ClassAProperty = Guid.NewGuid().ToString() };
                    else
                        o = new ClassB() { ClassBProperty = Guid.NewGuid().ToString() };
                    o.Title = Guid.NewGuid().ToString();
                    return o;
                });

            var result = this._client.IndexMany(data, new SimpleBulkParameters { Refresh = true });

            result.IsValid.Should().BeTrue();
            result.Items.Count().Should().Be(100);

            var queryResults = this._client.Search<MyBaseClass>(s => s
                .From(0)
                .Size(100)
                .MatchAll()
                .ConcreteTypeSelector((o, h) => o.classBProperty != null ? typeof(ClassB) : typeof(ClassA))
            );
            Assert.True(queryResults.IsValid);
            Assert.True(queryResults.Documents.Any());

            queryResults.Documents.OfType<ClassA>().Any().Should().BeTrue();
            queryResults.Documents.OfType<ClassB>().Any().Should().BeTrue();
        }
开发者ID:trentcioran,项目名称:NEST,代码行数:31,代码来源:SubClassSupportTests.cs


示例4: Main

 static void Main(string[] args)
 {
     Checker check = new Checker(); 
     ClassA try1 = new ClassA();
     ClassB try2 = new ClassB();
     ClassC try3 = new ClassC();
     ClassD try4 = new ClassD();
     MyStruct try5 = new MyStruct();
     object try6 = try5;
     Console.WriteLine("Analyzing ClassA type variable:");
                       // Анализ переменной типа ClassA 
     check.Check(try1);
     Console.WriteLine("\nAnalyzing ClassB type variable:"); 
                       // Анализ переменной типа ClassB 
     check.Check(try2);
     Console.WriteLine("\nAnalyzing ClassC type variable:");
                       // Анализ переменной типа ClassC 
     check.Check(try3);
     Console.WriteLine("\nAnalyzing ClassD type variable:");
                       // Анализ переменной типа ClassD  
     check.Check(try4);
     Console.WriteLine("\nAnalyzing MyStruct type variable:");
                       // Анализ переменной типа MyStruct  
     check.Check(try5);
     Console.WriteLine("\nAnalyzing boxed MyStruct type variable:"); 
                       // Анализ упакованной 
     check.Check(try6); 
     Console.ReadKey(); 
 }
开发者ID:sev-it,项目名称:asp.net,代码行数:29,代码来源:Program.cs


示例5: TestGetTextProperty

        public void TestGetTextProperty()
        {
            const string textValue = "Mock Serialized String";
            var values = new List<string>
                {
                    "Foo string 1",
                    "Foo string 2"
                };
            
            var obj = new ClassA
            {
                Foo = "Foo String",
                ElementsBlobbed = textValue
            };

            var mockSerializer = new Mock<ITextBlobSerializer>();
            TextBlobOperations.SetTextSerializer(mockSerializer.Object); // Override default JSON serializer

            var obj1 = obj;
            var elementsProperty = typeof (ClassA).GetProperty("Elements");
            mockSerializer.Setup(serializer => serializer.Deserialize(textValue, elementsProperty.PropertyType)).Returns(() => values);

            TextBlobOperations.GetTextBlobChild(obj, typeof(ClassA).GetProperty("Elements"));

            Assert.AreEqual(values, obj1.Elements);
        }
开发者ID:xamarin-libraries,项目名称:sqlite.net-pcl-extensions,代码行数:26,代码来源:TextBlobTests.cs


示例6: execute

        public void execute()
        {
            ClassB b = new ClassB();
            ClassA a = new ClassA();
            b = a;

        }
开发者ID:rahulkamra,项目名称:LearningCSharp,代码行数:7,代码来源:1443260785$Chap12.cs


示例7: execute

        public void execute()
        {
            ClassA a = new ClassA();
            a.addCallBack(myCallBack);

            ClassB b = new ClassB();
        }
开发者ID:rahulkamra,项目名称:LearningCSharp,代码行数:7,代码来源:1443210899$chap9.cs


示例8: MultipleTypesUsingBaseClass

        public void MultipleTypesUsingBaseClass()
        {
            var data = Enumerable.Range(0, 100)
                .Select(i =>
                {
                    MyBaseClass o = null;
                    if (i % 2 == 0)
                        o = new ClassA() { ClassAProperty = Guid.NewGuid().ToString() };
                    else
                        o = new ClassB() { ClassBProperty = Guid.NewGuid().ToString() };
                    o.Title = Guid.NewGuid().ToString();
                    return o;
                });

            var resulta = this._client.IndexMany(data.OfType<ClassA>(), new SimpleBulkParameters { Refresh = true });
            var resultb = this._client.IndexMany(data.OfType<ClassB>(), new SimpleBulkParameters { Refresh = true });

            var queryResults = this._client.Search<MyBaseClass>(s => s
                .Types(typeof(ClassA), typeof(ClassB))
                .From(0)
                .Size(100)
                .MatchAll()
            );
            Assert.True(queryResults.IsValid);
            Assert.True(queryResults.Documents.Any());

            queryResults.Documents.OfType<ClassA>().Any().Should().BeTrue();
            queryResults.Documents.OfType<ClassB>().Any().Should().BeTrue();
        }
开发者ID:trentcioran,项目名称:NEST,代码行数:29,代码来源:SubClassSupportTests.cs


示例9: execute

        public void execute()
        {
            ClassA<ClassC> a = new ClassA<ClassC>();
            ClassB<ClassC> b = new ClassB<ClassC>();

            a = b;
        }
开发者ID:rahulkamra,项目名称:LearningCSharp,代码行数:7,代码来源:1444413206$Chap12.cs


示例10: AccessAnnotationDirectly

        public void AccessAnnotationDirectly()
        {
            var target = new ClassA();

            target.Annotation()["Tags"] = new[] {"C#", "Tests"};

            CollectionAssert.AreEqual(target.Annotation<string[]>("Tags"), new[] {"C#", "Tests"});
        }
开发者ID:tiwariritesh7,项目名称:devdefined-tools,代码行数:8,代码来源:AnnotationTests.cs


示例11: T02_Dispose_Instance

 public void T02_Dispose_Instance()
 {
     var container = new Container(defaultLifestyle: DefaultLifestyle.Singleton, log: Write);
     var instance = new ClassA();
     container.RegisterInstance(instance);
     container.Dispose();
     Assert.True(instance.IsDisposed);
 }
开发者ID:dshe,项目名称:StandardContainer,代码行数:8,代码来源:DisposeTest.cs


示例12: RegisterInstanceGeneric

        public void RegisterInstanceGeneric()
        {
            var obj = new ClassA ();

            ServiceContainer.Register (obj);

            Assert.That (ServiceContainer.Resolve<ClassA>(), Is.EqualTo (obj));
        }
开发者ID:MilenPavlov,项目名称:XPlatUtils,代码行数:8,代码来源:ServiceContainerTests.cs


示例13: execute

        public void execute()   
        {
            ClassA a = new ClassA();
            ClassB b = new ClassB();

            ClassC<ClassA> ca = new ClassC<ClassA>();
            ca.result(test);
        }
开发者ID:rahulkamra,项目名称:LearningCSharp,代码行数:8,代码来源:1444414349$Chap12.cs


示例14: execute

        public void execute()
        {
            ClassA a = new ClassA();
            a.addCallBack(myCallBack);

            a.addActionCallBack(callbackAction);
            
        }
开发者ID:rahulkamra,项目名称:LearningCSharp,代码行数:8,代码来源:1443211623$chap9.cs


示例15: RegisterInterface

        public void RegisterInterface()
        {
            var obj = new ClassA ();

            ServiceContainer.Register<InterfaceA> (obj);

            Assert.That (ServiceContainer.Resolve<InterfaceA> (), Is.EqualTo (obj));
        }
开发者ID:slodge,项目名称:XPlatUtils,代码行数:8,代码来源:ServiceContainerTests.cs


示例16: TestAddInt

		public void TestAddInt ()
		{
			var one = new ClassA (10);

			var two = one + 1;

			Assert.AreEqual (one.Value + 1, two.Value);
		}
开发者ID:caloggins,项目名称:DOT-NET-on-Linux,代码行数:8,代码来源:OperatorOverloadExampleTests.cs


示例17: execute

        public void execute()
        {
            ClassA a = new ClassA();
            a.addCallBack(myCallBack);

            ClassB b = new ClassB();
            b.process(callbackAction);
        }
开发者ID:rahulkamra,项目名称:LearningCSharp,代码行数:8,代码来源:1443211414$chap9.cs


示例18: ShouldMatchAnyExpression

 public void ShouldMatchAnyExpression()
 {
     var r = CreateReport();
     var o = new ClassA();
     //Simulate an error occuring on ClassA
     r.AddError(new ValidationError(CreateRule(), EquatableExpression.Create<ClassA, int>(a => a.A), new object[0], o, o, EquatableExpression.Create<ClassA, int>(a => a.A)));
     //Passing in null should match any errors on any expressions...
     Assert.IsTrue(r.HasError(o, null));
 }
开发者ID:Allen-Wei,项目名称:RulesEngineV3.x,代码行数:9,代码来源:ValidationReportTests.cs


示例19: execute

        public void execute()   
        {
            ClassA<string> a1 = new ClassB<ClassC>();
            ClassA<object> a2 = new ClassA<object>();

            a2 = a1;

    
        }
开发者ID:rahulkamra,项目名称:LearningCSharp,代码行数:9,代码来源:1444415322$Chap12.cs


示例20: execute

        public void execute()   
        {
            ClassA a = new ClassA();
            ClassB b = new ClassB();


            ClassC<ClassA> ca = new ClassC<ClassA>();
           
        }
开发者ID:rahulkamra,项目名称:LearningCSharp,代码行数:9,代码来源:1444414009$Chap12.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ClassDataContract类代码示例发布时间:2022-05-24
下一篇:
C# Class2类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap