public static void Demo() { Console.WriteLine("Casting =============="); object myClass = new MyClass(); object anotherClass = new AnotherClass(); // ReSharper disable once SafeCastIsUsedAsTypeCheck Trace.Assert(myClass as MyInterface != null); Trace.Assert(myClass is MyInterface); // ReSharper disable once SafeCastIsUsedAsTypeCheck Trace.Assert(anotherClass as MyInterface == null); //<<<<< doesn't throw Trace.Assert(!(anotherClass is MyInterface)); var x = (MyInterface)myClass; try { x = (MyInterface)anotherClass; Trace.Fail("Should not reach here"); } catch (InvalidCastException) { // expected } Trace.Assert(x == myClass); }
public void ReturnsTrueForDefaultClass() { object target = new AnotherClass(); var result = Testers.CheckNullInequality(target); Assert.True(result); }
void Start() { alpha = 29; // defines a new object tied to a specified class in another script myOtherClass = new AnotherClass(); myOtherClass.Fruitmachine(alpha, myOtherClass.apples); // it goes into a loop, but you get it }
void Start() { alpha = 29; myOtherClass = new AnotherClass(); myOtherClass.Add(alpha, myOtherClass.ten); }
public void AndReturnTrueForBasicObjects() { object target = new AnotherClass(); var result = Testers.CheckTypeInequality(typeof(AnotherClass), target); Assert.True(result); }
public MyRepository(IBaseRepository _baseRepository, IUid uid) { _baseRepository = baseRepository; _uid = uid; _anotherClass = BaseRepository.Db.SingleOrDefault <AnotherClass>(); //another logic in here.... }
void test() { var calc = new IFix.Test.Calculator(); //test calc.Add UnityEngine.Debug.Log("10 + 9 = " + calc.Add(10, 9)); //test calc.Sub UnityEngine.Debug.Log("10 - 2 = " + calc.Sub(10, 2)); var anotherClass = new AnotherClass(1); //AnotherClass in Assembly-CSharp-firstpass.dll var ret = anotherClass.Call(i => i + 1); UnityEngine.Debug.Log("anotherClass.Call, ret = " + ret); //test for InjectFix/Fix(Android) InjectFix/Fix(IOS) Menu for unity 2018.3 or newer #if UNITY_2018_3_OR_NEWER #if UNITY_IOS UnityEngine.Debug.Log("UNITY_IOS"); #endif #if UNITY_EDITOR UnityEngine.Debug.Log("UNITY_EDITOR"); #endif #if UNITY_ANDROID UnityEngine.Debug.Log("UNITY_ANDROID"); #endif #endif }
void Start() { alpha = 32; myOtherClass = new AnotherClass(); myOtherClass.FruitMachine(alpha,myOtherClass.raspberries); }
// Start is called before the first frame update void Start() { myOtherClass = new AnotherClass(); myOtherClass.FruitMachine(banana, myOtherClass.apples); myOtherClass.apples = 20; Debug.Log(myOtherClass.apples); }
void Start() { alpha = 29; myOtherClass = new AnotherClass(); myOtherClass.FruitMachine(alpha, myOtherClass.apples); }
public static List <UserRole> Role() { //Call another class with method to fill the list AnotherClass _anotherClass = new AnotherClass(); return(_anotherClass.Roles()); }
void Start() { alpha = 32; myOtherClass = new AnotherClass(); myOtherClass.FruitMachine(alpha, myOtherClass.raspberries); }
void Start () { alpha = 50; myOtherClass = new AnotherClass(); myOtherClass.JuiceStand(alpha, myOtherClass.apples); }
//Constructor public MyStruct(int a, int b, int c) { myClass = new AnotherClass(); myClass.number = a; x = b; y = c; myDays = Days.Mon; }
public static void DoSample() { Runner runner = new Runner(); AnotherClass anotherClass = new AnotherClass(); runner.Add("a"); ////anotherClass.DoSomeThing(); }
void Start() { alpha = 29; myOtherClass = new AnotherClass(); myOtherClass.FruitMachine(alpha, myOtherClass.apples); Debug.Log("Alpha is set to: " + alpha); }
public void OnSingleObject() { var target = new AnotherClass(); var(propertyValues, _) = Creator.GetPropertyAndFieldValues(typeof(AnotherClass), null); Creator.SetPropertyValues(target, propertyValues); Approvals.Verify(target.ToString()); }
public void AndReturnsTrueForForTheSameBasicObject() { object thing = new AnotherClass { SomeNumber = 5 }; var result = Testers.CheckEquality(thing, thing); Assert.True(result); }
void Start() { x = 29; myOtherClass = new AnotherClass(); myOtherClass.agentMachine(x, myOtherClass.sunglasses); //myOtherClass = new AnotherClass (); //myOtherClass.agentMachine (myOtherClass.earpiece ); }
static void Main(string[] args) { AnotherClass c = new AnotherClass(); c.List.Add("aaa"); Console.WriteLine(c.ReadonlyList[0]); // prints "aaa" c.List.Add("bbb"); Console.WriteLine(c.ReadonlyList[1]); // prints "bbb" Console.Read(); }
public static void AllLog() { AnotherClass.SayHello(); log1(); Log(); Warning(); Error(); Assertion(); Exception(); }
public Logic() { var anotherClass = new AnotherClass(); MyObjectNames = new List<string>() { "Object01", "Object02", "Object03" }; // either add your names here... MyObjectNames.Add("Object04"); // or add additional names this way //MyObjectNames.AddRange(anotherNameList); // or add another list or use Linq or whatever MyObjectDict = anotherClass.InstantiateAllObjects(MyObjectNames); // objects in dict can be accessed directly by their names: var object01 = MyObjectDict["Object01"]; }
public GetterOnlyProperties() { _intList = new List <int>(); IntStringDictionaryWithPrivateSetter = new Dictionary <int, string>(); _intStringDictionary = new Dictionary <int, string>(); _customClass = new AnotherClass(); _customClassArray = new [] { new AnotherClass { A = 42 } }; _customStruct = new AnotherStruct(); }
public void ReturnsTrueForDefaultClassEvenIfStructurallyEqual() { object left = new AnotherClass { SomeNumber = 5, SomeString = "Hi", someByte = 2, someChar = 'B' }; object right = new AnotherClass { SomeNumber = 5, SomeString = "Hi", someByte = 2, someChar = 'B' }; var result = Testers.CheckInequality(left, right); Assert.True(result); }
public Logic() { var anotherClass = new AnotherClass(); MyObjectNames = new List <string>() { "Object01", "Object02", "Object03" }; // either add your names here... MyObjectNames.Add("Object04"); // or add additional names this way //MyObjectNames.AddRange(anotherNameList); // or add another list or use Linq or whatever MyObjectList = anotherClass.InstantiateAllObjects(MyObjectNames); }
public void AndReturnsFalseForDefaultObjectEvenIfStructurallyEqual() { object left = new AnotherClass { SomeNumber = 5, SomeString = "High-Low", someByte = 24, someChar = 'Z' }; object right = new AnotherClass { SomeNumber = 5, SomeString = "High-Low", someByte = 24, someChar = 'Z' }; var result = Testers.CheckEquality(left, right); Assert.False(result); }
protected void Page_Load(object sender, EventArgs e) { string vp1 = SampleClass.GetVirtualPath(); string vp2 = AnotherClass.GetVirtualPath(); Person p = new Person(); p.FirstName = "Joe"; p.LastName = "Public"; p.BirthDate = DateTime.Now.AddYears(-30); p.Location = "Milwaukee, WI"; lbl1.Text = vp1; lbl2.Text = vp2; }
public void OnMultipleObjectsAndExecutesDelegateOnEachProperty() { var a = new AnotherClass(); var properties = new List <string>(); var targets = new[] { a }; var(propertyValues, _) = Creator.GetPropertyAndFieldValues(typeof(AnotherClass), null); Action <PropertyInfo, ValueAccessors> collect = (property, value) => properties.Add($"{property} => {value}"); Creator.SetPropertyValues(targets, propertyValues, collect); Approvals.VerifyAll(properties, "result"); }
public void OnMultipleObjectsAndCallsDelegateOnEachField() { var a = new AnotherClass(); var fields = new List <string>(); var targets = new[] { a, }; var(_, fieldValues) = Creator.GetPropertyAndFieldValues(typeof(AnotherClass), null); Action <FieldInfo, ValueAccessors> noOp = (field, value) => { fields.Add($"{field} => {value}"); }; Creator.SetFieldValues(targets, fieldValues, noOp); Approvals.VerifyAll(fields, "result"); }
public void NUnitTest1() { var a = 2; var b = 2; var c = a + b; Assert.AreEqual(a, b); Assert.AreEqual(4, c); var obj = new AnotherClass(); obj.SomeProperty = 6; obj.SomeMethod(); }
void test() { var calc = new IFix.Test.Calculator(); //test calc.Add UnityEngine.Debug.Log("10 + 9 = " + calc.Add(10, 9)); //test calc.Sub UnityEngine.Debug.Log("10 - 2 = " + calc.Sub(10, 2)); var anotherClass = new AnotherClass(1); //AnotherClass in Assembly-CSharp-firstpass.dll var ret = anotherClass.Call(i => i + 1); UnityEngine.Debug.Log("anotherClass.Call, ret = " + ret); }
public void OnMultipleObjects() { var a = new AnotherClass(); var b = new AnotherClass(); var c = new AnotherClass(); var targets = new[] { a, b }; var(propertyValues, _) = Creator.GetPropertyAndFieldValues(typeof(AnotherClass), null); Action <PropertyInfo, object> noOp = (p, v) => { }; Creator.SetPropertyValues(targets, propertyValues, noOp); Assert.Equal(a.ToString(), b.ToString()); Assert.NotEqual(a.ToString(), c.ToString()); }
public int SomeMethodWithParams(int first, AnotherClass second) { return second.SomeValue + first; }
void Start() { alpha = 45; // use new class instance myAnotherClass = new AnotherClass(); myAnotherClass.FruitMachine(3, 54); // use new class instance myLoopClass = new ExampleLoopExers(); myLoopClass.Start(); }