本文整理汇总了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();
}
示例2: Create
private void Create(BaseClass baseClass, Write write)
{
BaseClass = baseClass;
Define = new Define();
Init = new Init(this);
Write = write;
}
示例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());
}
示例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;
}
}
}
示例5: Main
static void Main(string[] args)
{
BaseClass ba = new BaseClass("Arif");
BaseClass.MySecondClass mySecond = ba.GetMySecondClass();
mySecond.MyMethod();
}
示例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;
}
}
示例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>();
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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>();
}
示例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);
}
示例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);
}
示例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."));
}