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


C# BaseClass类代码示例

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


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


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