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


C# ClassA类代码示例

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


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


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