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

C# BaseClass类代码示例

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

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



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

示例1: Main

        static void Main(string[] args)
        {
            //MyGenerics<int> mygen = new MyGenerics<int>(100);
            

            //    myclass[] m = new myclass[5];
            //    //for (int i = 0; i <= m.GetUpperBound(0); i++)
            //    //{
            //    //    m[i] = new myclass("Sub" + i);
            //    //}
            //    //Console.WriteLine(m.GetUpperBound(0));
            //    //Console.WriteLine(m.GetLowerBound(0));

            //    //MyGenerics<myclass> mygen = new MyGenerics<myclass>(m);
            //    ////mygen.ShowT();
            //    //mygen.IterateT();
            //    int num1 = 10;
            //    int num2 = 20;
            //    string fname = "arif";
            //    string lname = "khan";
            //    Console.WriteLine("Number1 : " + num1 + " Number2 : " + num2);

            //    GenericMethod method = new GenericMethod();
            //    method.Swap<int>(ref num1, ref num2);
            //    method.Swap<string>(ref fname, ref lname);
            //    Console.WriteLine("Frist name " + fname + " Lname " + lname);
            //    Console.WriteLine("Number1 : " + num1 + " Number2 : " + num2);
            //}
            BaseClass<int> bs = new BaseClass<int>(100, 200);
            bs.Show();
            bs.Swap();
            bs.Show();
            
            
        }
开发者ID:EdiCarlos,项目名称:MyPractices,代码行数:35,代码来源:Program.cs


示例2: Create

 private void Create(BaseClass baseClass, Write write)
 {
     BaseClass = baseClass;
     Define = new Define();
     Init = new Init(this);
     Write = write;
 }
开发者ID:Nefylem,项目名称:consoleXstream,代码行数:7,代码来源:Classes.cs


示例3: CallBaseMethod

        public static void CallBaseMethod(
            BaseClass fake,
            int returnValue,
            bool callbackWasInvoked)
        {
            "Given a fake"
                .x(() => fake = A.Fake<BaseClass>());

            "And I configure a method to invoke an action and call the base method"
                .x(() =>
                    A.CallTo(() => fake.ReturnSomething())
                        .Invokes(x => callbackWasInvoked = true)
                        .CallsBaseMethod());

            "When I call the method"
                .x(() => returnValue = fake.ReturnSomething());

            "Then it calls the base method"
                .x(() => fake.WasCalled.Should().BeTrue());

            "And it returns the value from base method"
                .x(() => returnValue.Should().Be(10));

            "And it invokes the callback"
                .x(() => callbackWasInvoked.Should().BeTrue());
        }
开发者ID:TimLovellSmith,项目名称:FakeItEasy,代码行数:26,代码来源:ConfigurationSpecs.cs


示例4: Start

    // Use this for initialization
    void Start()
    {
		holder = transform.GetChild(0).gameObject;
		// this is bad, dont do it lol. ill fix it later
		spriteRenderer 	= holder.transform.GetChild(0).GetComponent<SpriteRenderer>();
		if(isBuilding)
		{
			baseBuilding = transform.parent.gameObject.GetComponent<Building>();
			TotalHealth = baseBuilding.health;
			if(baseBuilding.team == GameData.MyPlayer.TeamID)
			{
				spriteRenderer.sprite = allyHealth;
			}else
			{
				spriteRenderer.sprite = enemyHealth;
			}
		}else
		{
			baseClass 		= transform.parent.gameObject.GetComponent<BaseClass>();
			TotalHealth		= baseClass.ClassStat.MaxHp;
			
			// fix this later too
			if(baseClass.team == GameData.MyPlayer.TeamID)
			{
				spriteRenderer.sprite = allyHealth;
			}else
			{
				spriteRenderer.sprite = enemyHealth;
			}
		}

	}
开发者ID:CarsonRoscoe,项目名称:DefendAman,代码行数:33,代码来源:HealthBar.cs


示例5: Main

        static void Main(string[] args)
        {
            BaseClass ba = new BaseClass("Arif");

            BaseClass.MySecondClass mySecond = ba.GetMySecondClass();
            mySecond.MyMethod(); 
        }
开发者ID:EdiCarlos,项目名称:MyPractices,代码行数:7,代码来源:Program.cs


示例6: Main

    public static void Main() {

        BaseClass obj1=new BaseClass();
        CheckReturnedInt(obj1.F1("obj1"), 1);
        CheckReturnedString(obj1.F2("obj1"), "String returned from BaseClass.F2:obj1");
        CheckReturnedString(obj1.NonVirtualFunc(11), "String returned from BaseClass.NonVirtualFunc:11");
        Console.WriteLine("");

        DerivedClass obj2=new DerivedClass();
        CheckReturnedInt(obj2.F1("obj2"), 2);
        CheckReturnedString(obj2.F2("obj2"), "String returned from DerivedClass.F2:obj2");
        CheckReturnedString(obj2.NonVirtualFunc(15), "String returned from DerivedClass.NonVirtualFunc:30");
        Console.WriteLine("");

        BaseClass objectRef;
        objectRef = obj1;
        CheckReturnedInt(objectRef.F1("objectRef is now obj1"), 1);
        CheckReturnedString(objectRef.F2("objectRef is now obj1"), "String returned from BaseClass.F2:objectRef is now obj1");
        CheckReturnedString(objectRef.NonVirtualFunc(11), "String returned from BaseClass.NonVirtualFunc:11");
        Console.WriteLine("");

        objectRef = obj2;
        CheckReturnedInt(objectRef.F1("objectRef is now obj2"), 2);
        CheckReturnedString(objectRef.F2("objectRef is now obj2"), "String returned from DerivedClass.F2:objectRef is now obj2");
        CheckReturnedString(objectRef.NonVirtualFunc(15), "String returned from BaseClass.NonVirtualFunc:15");
        Console.WriteLine("");

        if (failed) {
             System.Environment.ExitCode = 1;
        }
        else {
             System.Environment.ExitCode = 0;
        }
        
    }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:35,代码来源:baseclass_dispatch.cs


示例7: Configuration

        public Configuration(BaseClass home)
        {
            Class = new Classes(this);
            Class.DeclareClasses(home);

            Class.Set.Title = new List<string>();
            Class.Set.Data = new List<string>();
        }
开发者ID:jpenalbae,项目名称:consoleXstream,代码行数:8,代码来源:Configuration.cs


示例8: BookingClass

		/// <summary>
		/// Создание объекта класс с инициализацией полей
		/// </summary>
		/// <param name="bookingClassCode">Класс перелёта</param>
		/// <param name="baseClass">Базовый класс перелёта</param>
		/// <param name="baggage">Допустимая мера багажа для данного класса перелёта</param>
        public BookingClass(string bookingClassCode, BaseClass? baseClass = null, int freeSeatCount = -1, string mealType = null, Baggage baggage = null)
		{
			BookingClassCode = bookingClassCode;
            BaseClass = baseClass;
			Baggage = baggage;
			MealType = mealType;

			FreeSeatCount = freeSeatCount >= 0 ? freeSeatCount : (int?)null;
		}
开发者ID:MuteLab,项目名称:nemo.travel.SDK,代码行数:15,代码来源:BookingClass.cs


示例9: Start

 new void Start()
 {
     base.Start();
     target = gameObject.GetComponent<BaseClass>();
     target.ClassStat.AtkPower += attackBuff;
     target.ClassStat.Defense += defenseBuff;
     target.ClassStat.MoveSpeed += speedBuff;
     duration = 75;
 }
开发者ID:alvinman,项目名称:defendaman,代码行数:9,代码来源:AmanTeamBuff.cs


示例10: BaseClass

        public void SimpleContextExpression_InvocationOfAMethodThatReturnsTheValueOfASpecificPropertyOfTheInstance_ReturnsTheCorrectValueOfTheProperty()
        {
            BaseClass @base = new BaseClass();
			Func<int> @delegate = @base.GetValue;
            var func = ExecuteLambdaWithContext<Func<int>, BaseClass>(@delegate, @base);
            var result = func();

            Assert.AreEqual(result, 10);
        }
开发者ID:sagifogel,项目名称:NJection.LambdaConverter,代码行数:9,代码来源:ContextExpression.cs


示例11: VerifyAddRemoveEventHandler3

 public void VerifyAddRemoveEventHandler3()
 {
     EventInfo ei = GetEventInfo(typeof(BaseClass), "EventPublicVirtual");
     Assert.NotNull(ei);
     EventHandler myhandler = new EventHandler(MyEventHandler);
     BaseClass obj = new BaseClass();
     ei.AddEventHandler(obj, myhandler);
     //Try to remove event Handler and Verify that no exception is thrown.
     ei.RemoveEventHandler(obj, myhandler);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:10,代码来源:EventInfo_MethodTests.cs


示例12: Start

	// Use this for initialization
	void Start () {
        lastPosition = transform.position;
        NetworkingManager.Subscribe(update_position, DataType.Player, playerID);
        NetworkingManager.Subscribe(took_damage, DataType.Hit, playerID);
        NetworkingManager.Subscribe(died, DataType.Killed, playerID);
        NetworkingManager.Subscribe(use_potion, DataType.Potion, playerID);
        NetworkingManager.Subscribe(new_stats, DataType.StatUpdate, playerID);
        GameData.PlayerPosition.Add(playerID, transform.position);
        baseClass = GetComponent<BaseClass>();
        animator = gameObject.GetComponent<Animator>();
    }
开发者ID:CarsonRoscoe,项目名称:DefendAman,代码行数:12,代码来源:PlayerReceiveUpdates.cs


示例13: Start

    void Start()
    {
        rb2d = GetComponent<Rigidbody2D>();
        midX = Screen.width / 2;
        midY = Screen.height / 2;
        up = "w";
        down = "s";
        left = "a";
        right = "d";
        movestyles = movestyle.absolute;
		anim = gameObject.GetComponent<Animator>();
		baseClass = gameObject.GetComponent<BaseClass>();
        GameData.PlayerPosition.Add(GameData.MyPlayer.PlayerID, transform.position);
    }
开发者ID:CarsonRoscoe,项目名称:DefendAman,代码行数:14,代码来源:Movement.cs


示例14: SetValue_SetsPropertyValue

        public void SetValue_SetsPropertyValue()
        {
            // Arrange
            var expected = "new value";
            var instance = new BaseClass { PropA = "old value" };
            var helper = PropertyHelper.GetProperties(
                instance.GetType()).First(prop => prop.Name == "PropA");

            // Act
            helper.SetValue(instance, expected);

            // Assert
            Assert.Equal(expected, instance.PropA);
        }
开发者ID:leloulight,项目名称:Common,代码行数:14,代码来源:PropertyHelperTest.cs


示例15: CallToNonVirtualNonVoidOnFake

        public static void CallToNonVirtualNonVoidOnFake(
            BaseClass fake,
            Exception exception)
        {
            "Given a fake"
                .x(() => fake = A.Fake<BaseClass>());

            "When I start to configure a non-virtual non-void method on the fake"
                .x(() => exception = Record.Exception(() => A.CallTo(() => fake.ReturnSomethingNonVirtual())));

            "Then it throws a fake configuration exception"
                .x(() => exception.Should().BeAnExceptionOfType<FakeConfigurationException>()
                    .And.Message.Should().Contain("Non virtual methods can not be intercepted."));
        }
开发者ID:bman61,项目名称:FakeItEasy,代码行数:14,代码来源:ConfigurationSpecs.cs


示例16: CanSetTransparentProxy

        public void CanSetTransparentProxy()
        {
            PropertyOrFieldNode pofNode = new PropertyOrFieldNode();
            pofNode.Text = "ObjectProp";

            BaseClass ouc = new BaseClass();
            TestTransparentProxyFactory tpf = new TestTransparentProxyFactory(null, typeof(ITestObject), null);
            object tpo = tpf.GetTransparentProxy();
            Assert.IsTrue( tpo is ITestObject );
            ITestObject itpo = tpo as ITestObject;
            Assert.IsNotNull(itpo);
            pofNode.SetValue( ouc, null, itpo);
            Assert.AreSame( tpo, ouc.ObjectProp );
        }
开发者ID:fgq841103,项目名称:spring-net,代码行数:14,代码来源:PropertyOrFieldNodeTests.cs


示例17: PropertyHelper_ReturnsSetterDelegate

        public void PropertyHelper_ReturnsSetterDelegate()
        {
            // Arrange
            var expected = "new value";
            var instance = new BaseClass { PropA = "old value" };
            var helper = PropertyHelper.GetProperties(
                instance.GetType()).First(prop => prop.Name == "PropA");

            // Act and Assert
            Assert.NotNull(helper.ValueSetter);
            helper.ValueSetter(instance, expected);

            // Assert
            Assert.Equal(expected, instance.PropA);
        }
开发者ID:leloulight,项目名称:Common,代码行数:15,代码来源:PropertyHelperTest.cs


示例18: inheritance

        internal static void inheritance()
        {
            Console.Clear();

            BaseClass b = new BaseClass();
            Program1 p = new Program1();

            b.print();
            p.print();

            Console.WriteLine("BaseClass.math: {0}", b.math(2, 3));
            Console.WriteLine("Inheritance.math: {0}", p.math(2, 3));

            Console.ReadLine();
            return;
        }
开发者ID:Jefe505,项目名称:CSharp,代码行数:16,代码来源:Program1.cs


示例19: Start

    new void Start()
    {
        base.Start();
        target = gameObject.GetComponent<BaseClass>();
        target.ClassStat.MaxHp += hpBuff;

        area = (Rigidbody2D)Resources.Load("Prefabs/AmanBuffArea", typeof(Rigidbody2D));
        //load indicator
        if (target.playerID == GameData.AllyKingID)
            indicator = (GameObject)Resources.Load("Prefabs/AllyAmanCircle", typeof(GameObject));
        else
            indicator = (GameObject)Resources.Load("Prefabs/EnemyAmanCircle", typeof(GameObject));

        instance = (GameObject)Instantiate(indicator, transform.position, transform.rotation);
        instance.transform.parent = target.transform;
    }
开发者ID:alvinman,项目名称:defendaman,代码行数:16,代码来源:AmanSelfBuff.cs


示例20: Chapter2

    public Chapter2()
    {
        BaseClass baseObj = new BaseClass();
        DerivedAlpha dObj1 = new DerivedAlpha();
        DerivedBeta dObj2 = new DerivedBeta();

        BaseClass baseRef;

        baseRef = baseObj;
        baseRef.Metod();

        baseRef = dObj1;
        baseRef.Metod();

        baseRef = dObj2;
        baseRef.Metod();
    }
开发者ID:saniainf,项目名称:uchebnik,代码行数:17,代码来源:Chapter2.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# BaseClassSpecifier类代码示例发布时间:2022-05-24
下一篇:
C# BaseCell类代码示例发布时间: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