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(); }
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")); }
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(); }
public void execute() { ClassA a = new ClassA(); a.addCallBack(myCallBack); ClassB b = new ClassB(); }
//abstract classes public void execute() { // ClassA classA = new ClassA(); // cannot do this , Class A is abstract ClassA classA = new ClassB(); Debug.Log(ClassB.variable); }
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(); }
public void execute() { ClassA c = ClassA.five; Debug.Log(c.toGeneratedString()); ClassB b = new ClassB(); }
public void execute() { ClassA a = new ClassA(); a.addCallBack(myCallBack); ClassB b = new ClassB(); b.process(callbackAction); }
private string SomeMethodResolvingTypes() { return _cache.GetFromCacheOrFetch("key", () => { var classB = new ClassB(); return "done!"; }); }
public static void Main() { ClassA a = new ClassA(); a.Print(); ClassB b = new ClassB(); b.Print(); ClassC c = new ClassC(); c.Print(); }
public void execute() { ClassA c = ClassA.five; //this is too dangerous , as this method will exist in every object Debug.Log(c.toGeneratedString()); ClassB b = new ClassB(); testStruct(b); }
public void ShouldHaveErrorB1() { var r = CreateReport(); var o = new ClassB(); //Simulate an error occuring on ClassB. r.AddError(new ValidationError(CreateRule(), EquatableExpression.Create<ClassB, int>(a => a.A), new object[0], o, o, EquatableExpression.Create<ClassB, int>(a => a.A))); Assert.IsTrue(r.HasError(o, EquatableExpression.Create<ClassA, int>(a => a.A))); //Eventhough, o is not ClassB, the expression b => b.A still applies to a ClassA. And therefore the following statement must be true. Assert.IsTrue(r.HasError(o, EquatableExpression.Create<ClassB, int>(b => b.A))); }
private void btnAuthorizationA_Click(object sender, RoutedEventArgs e) { txtAuthorizationA.Text = String.Empty; SLPrincipal.Logout(); SLPrincipal.Login("TestUser", "1234", "ClassARole;PropertyARole", (o, e2) => { bool pass = true; try { ClassA classA = new ClassA(); classA.A = "test"; classA.B = "test"; if (classA.A != "test" || classA.B != "test") pass = false; if (!pass) throw new Exception(); ClassA.Fetch((o3, e3) => { try { if (e3.Object == null || (e3.Object.A != "test" && e3.Object.B != "test")) pass = false; ClassB classB = new ClassB(); classB.A = "test"; classB.B = "test"; if (classB.A != "test" || classB.B != "test") pass = false; if (pass) { txtAuthorizationA.Text = "Pass"; } else { txtAuthorizationA.Text = "Fail"; } } catch (Exception ex) { txtAuthorizationA.Text = "Fail"; } }); } catch (Exception ex) { pass = false; } }); }
public override void Run() { var c1 = new ClassA { Value = "ClassA" }; var c2 = new ClassB { Value = "ClassB", MessageProperties = new Dictionary<string, object> { { "k", "v" } } }; IBusMessage c3 = c1; IBusMessage c4 = c2; Console.WriteLine("c1 is IBusMessage: {0}", c1 is IBusMessage); Console.WriteLine("c1 is IBusCommand: {0}", c1 is IBusCommand); Console.WriteLine("c1 is IExtendable: {0}", c1 is IExtendable); Console.WriteLine("c1 has Type: {0}", c1.GetType()); Console.WriteLine("c2 is IBusMessage: {0}", c2 is IBusMessage); Console.WriteLine("c2 is IBusCommand: {0}", c2 is IBusCommand); Console.WriteLine("c2 is IExtendable: {0}", c2 is IExtendable); Console.WriteLine("c2 has Type: {0}", c2.GetType()); Console.WriteLine("c3 is IBusMessage: {0}", c3 is IBusMessage); Console.WriteLine("c3 is IBusCommand: {0}", c3 is IBusCommand); Console.WriteLine("c3 is IExtendable: {0}", c3 is IExtendable); Console.WriteLine("c3 as json: {0}", JsonConvert.SerializeObject(c3)); Console.WriteLine("c3 has Type: {0}", c3.GetType()); Console.WriteLine("c4 is IBusMessage: {0}", c4 is IBusMessage); Console.WriteLine("c4 is IBusCommand: {0}", c4 is IBusCommand); Console.WriteLine("c4 is IExtendable: {0}", c4 is IExtendable); Console.WriteLine("c4 as json: {0}", JsonConvert.SerializeObject(c4)); Console.WriteLine("c4 has Type: {0}", c4.GetType()); if (c4 is IExtendable) { var obj = c4 as IExtendable; Console.WriteLine("obj has Type: {0}", obj.GetType()); Console.WriteLine("obj.MessageProperties before: {0}", JsonConvert.SerializeObject(obj.MessageProperties)); obj.MessageProperties.Clear(); obj.MessageProperties = null; Console.WriteLine("obj.MessageProperties after: {0}", JsonConvert.SerializeObject(obj.MessageProperties)); Console.WriteLine("c4.MessageProperties: {0}", JsonConvert.SerializeObject(((IExtendable)c4).MessageProperties)); } Console.ReadLine(); }
public void CanSetStateOfExternalInstance() { var writeTimeRespository = new TestRepository(); var writeTimeInstance = new ClassB(3); var xmlText = SerializeAsXml(new ClassA(writeTimeInstance), writeTimeRespository); var readTimeRepository = new TestRepository(); var readTimeInstance = new ClassB(23); readTimeRepository.Add(readTimeInstance.GetType(), readTimeInstance); var readClass = ReadXmlText<ClassA>(xmlText, readTimeRepository, null, null); Assert.AreSame(readTimeInstance, readClass.Parameter); Assert.AreEqual(3, readClass.Parameter.Parameter); }
public void ReadWriteFromHelperUsingPropertyTest() { var bs = new BitStream(512); var a = new ClassB { A = "asdf", B = 512 }; var b = new ClassB(); a.WriteState(bs); bs.PositionBits = 0; b.ReadState(bs); Assert.AreEqual(a.A, b.A); Assert.AreEqual(a.B, b.B); }
//public int Add(int a, int b) { // return a + b; //} static void Main(string[] args) { //Program12 c = new Program12(); //MethodInfo methodInfo = c.GetType().GetMethod("Add"); //int r = (int)methodInfo.Invoke(c,new object[] { 2, 2 }); //Console.WriteLine(r); //4 ClassB b = new ClassB(); b = null; GC.Collect(); // Force //- Console.ReadKey(); }
static void Main(string[] args) { // DCI stuff var destination = new SavingsAccount("39.16.23.397", 0); var src = new SavingsAccount("1588.05.720", 19000); var useCase = new TransferMoneyContext(src, destination, 50.22); useCase.PrintState(); useCase.Execute(); // Monad stuff var strMonad = "aap".ToViewModel(); var result = strMonad.Bind(str => { var x = str + "kip"; return x.ToViewModel(); }) .Bind(str => { var x = str + "schapie"; return x.ToViewModel(); }); Console.WriteLine("Value string monad: {0}", result.Value); // transform current date to SideEffectsMonad with 0 as Sum var res = DateTime.Now.ToSideEffects() // add one day to internal date value of the monad (becoming tomorrow), transform it to a Monad itself and instantiate it with Sum set to 5. // this is then the return value of the anonymous function called over the instantiated internal DateTime value (DateTime.Now) // Bind() returns a new Monad based on this result and its internal state (Today, 0) becoming (Tomorrow, 5) .Bind(dt => dt.AddDays(1).ToSideEffects(5)) // as a result of immutable types, chaining becomes a possibility. the result value of the former Bind() is used as input for this one. // here we add a month to the day of tomorrow and add 0 (no param in ToSideEffects) to the Sum property. // how does this work again? // Bind() calls the provided function over its internal value. // therefore its internal _val is used for dt, which is raised by a month and then transformed to a Monad with 0 as Sum. // Bind merges this new Monad (TomorrowAndOneMonth, 0) with its internal state (Tomorrow, 5) to another new Monad. // In this merging, the new value type is copied (TomorrowAndOneMonth) and the old Sum state (5) is added to the new Monad's Sum (0) // This results in (TomorrowAndOneMonth, 5) .Bind(dt => dt.AddMonths(1).ToSideEffects()); Console.WriteLine("Value datetime monad: {0}", res.Value); Console.WriteLine("Sum output datetime monad: {0}", res.Sum); // Visitor stuff var a = new ClassA(); a.SomeInt = 62; var b = new ClassB(); var i = a.Accept<int>(new CountVisitor(), 0); var i2 = b.Accept<int>(new CountVisitor(), i); Console.WriteLine("CountVisitor over Class A: {0}", i); Console.WriteLine("CountVisitor over Class B: {0}", i2); Console.ReadKey(); }
public void execute() { ClassA c = ClassA.five; //this is too dangerous , as this method will exist in every object Debug.Log(c.toGeneratedString()); ClassB b = new ClassB(); b.x = 10; b.y = 10; testStruct(b); Debug.Log(b.x);// no change the in the value. }
public void MultipleTypesUsingBaseClassMultiSearch() { 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.Bulk(b => b.IndexMany(data.OfType<ClassA>()).Refresh()); var resultb = this._client.Bulk(b => b.IndexMany(data.OfType<ClassB>()).Refresh()); var queryResults = this._client.MultiSearch(ms => ms .Search<MyBaseClass>("using_types", s => s.AllIndices() .Types(typeof(ClassA), typeof(ClassB)) .From(0) .Size(100) .MatchAll() ) .Search<MyBaseClass>("using_selector", s => s.AllIndices() .Types("classa", "classb") .ConcreteTypeSelector((o, h) => o.classBProperty != null ? typeof(ClassB) : typeof(ClassA)) .From(0) .Size(100) .MatchAll() ) ); Assert.True(queryResults.IsValid); var firstResult = queryResults.GetResponse<MyBaseClass>("using_types"); Assert.True(firstResult.Documents.Any()); firstResult.Documents.OfType<ClassA>().Any().Should().BeTrue(); firstResult.Documents.OfType<ClassB>().Any().Should().BeTrue(); var secondResult = queryResults.GetResponse<MyBaseClass>("using_selector"); Assert.True(secondResult.Documents.Any()); secondResult.Documents.OfType<ClassA>().Any().Should().BeTrue(); secondResult.Documents.OfType<ClassB>().Any().Should().BeTrue(); }
//out parameters , which is a way to return multiple values. //ref parameter , which is similar to out , but it can be used to take the input as well public void execute() { ClassA a = new ClassA(); float sum; float subtract; float mul; float divide; a.doEverything(10, 15, out sum, out subtract, out mul, out divide); Debug.Log("sum" + sum); Debug.Log("subtract" + subtract); Debug.Log("mul" + mul); Debug.Log("divide" + divide); ClassB b = new ClassB(); string hello = "Hello World"; b.removeLastCharacter(ref hello); Debug.Log(hello); ClassA first = new ClassA(); first.x = 10; first.y = 15; ClassA second = new ClassA(); second.x = 10; second.y = 15; ClassA plus = first + second; Debug.Log(" + " + plus.x + " " + plus.y); ClassA sub = first - second; Debug.Log(" + " + sub.x + " " + sub.y); ClassA plusplus = ++first; Debug.Log(" + " + plusplus.x + " " + plusplus.y); }
public void execute() { ClassA<ClassC> ac = new ClassB<ClassC>(); ClassA<ClassD> ad = new ClassB<ClassD>(); // ad = ac; ad = ac; // this works because its (in) keyword which means only in params are accepted which means the super class can come in base class, //ac = ad; System.Reflection.MemberInfo info = typeof(Chapter12.ClassB<>); object[] attributes = info.GetCustomAttributes(true); Debug.Log(attributes.Count()); MyAttrib my = typeof(ClassB<>).GetCustomAttributes(typeof(MyAttrib), true).FirstOrDefault() as MyAttrib; Debug.Log(my.name); }
public void ApplicationScopeObjects_MembersAreNotSerialized() { ISystemDefinition writeTimeSystem = new SystemDefinition(); var writeTimeAdapter = new NDependencyInjectAdapter(writeTimeSystem); writeTimeSystem.HasInstance(new ClassB(1234)) .Provides<IClassB>(); var writeObject = new ClassA(writeTimeSystem.Get<IClassB>()); var xmlText = SerializeAsXml(writeObject, writeTimeAdapter); Assert.IsFalse(xmlText.Contains("1234")); ISystemDefinition readTimeSystem = new SystemDefinition(); var readTimeAdapter = new NDependencyInjectAdapter(readTimeSystem); var readTimeAppObject = new ClassB(3); readTimeSystem.HasInstance(readTimeAppObject) .Provides<IClassB>(); var readObject = ReadXmlText<ClassA>(xmlText, readTimeAdapter, null, null); Assert.AreSame(readTimeAppObject, readObject.Value); Assert.AreEqual(3, readObject.Value.ValueA); }
public void ObjectCopier_DifferentClasses_Succeeds() { ClassA objA = new ClassA { PropertyA = "1", PropertyB = 1, PropertyC = true, PropertyD = DateTime.UtcNow, PropertyE = EnumA.B }; ClassB objB = new ClassB(); ObjectCopier.CopyObject(objA, objB); Assert.IsTrue(objB.PropertyA.Equals(objA.PropertyA)); Assert.IsTrue(objB.PropertyB.Equals(objA.PropertyB)); Assert.IsTrue(objB.PropertyC.Equals(objA.PropertyC)); Assert.IsTrue(objB.PropertyD.Equals(objA.PropertyD)); Assert.IsTrue(objB.PropertyE.Equals(objA.PropertyE)); }
private void btnAuthorizationA_Click(object sender, RoutedEventArgs e) { txtAuthorizationA.Text = String.Empty; SLPrincipal.Logout(); SLPrincipal.Login("TestUserA", "1234", (o, e2) => { bool pass = true; try { ClassA classA = new ClassA(); classA.A = "test"; classA.B = "test"; if (classA.A != "test" || classA.B != "test") pass = false; ClassB classB = new ClassB(); classB.A = "test"; classB.B = "test"; if (classB.A != "test" || classB.B != "test") pass = false; } catch (Exception) { pass = false; } if (pass) { txtAuthorizationA.Text = "Pass"; } else { txtAuthorizationA.Text = "Fail"; } }); }
//function overriding and gochas public void execute() { ClassA _classA = new ClassA(10,100); ClassA _classAB = new ClassB(10); ClassB _classB = new ClassB(10); string resultB = _classB.inClass(); string resultAB_1 = _classAB.inClass(); string resultAB_2 = (_classAB as ClassB ).inClass(); string resultA = _classA.inClass(); Debug.Log(resultA); Debug.Log(resultB); Debug.Log(resultAB_1); Debug.Log(resultAB_2); }
static void Main() { object[] objArray = new object[6]; objArray[0] = new ClassA(); objArray[1] = new ClassB(); objArray[2] = "hello"; objArray[3] = 123; objArray[4] = 123.4; objArray[5] = null; for (int i = 0; i < objArray.Length; ++i) { string s = objArray[i] as string; Console.Write("{0}:", i); if (s != null) { Console.WriteLine("'" + s + "'"); } else { Console.WriteLine("not a string"); } } }
public ClassA(string name, int age, ClassB classV, ClassC classC) : this(name, age, classV) { this.ClassC = classC; }
public ClassA(ClassB classB) { this.classB = classB; }
public ClassA(int paramaterA, ClassB parameterB) { this.paramaterA = paramaterA; this.parameterB = parameterB; }
static void Main(string[] args) { ClassA classA = new ClassA("Anna", "Kowalska", 24, 160.5); ClassB classB = new ClassB("Jan", "Kowalski", 54, 180.5); ClassC classC = new ClassC("Hermenegilda", "Nowak", 66, 157.5); classA.B = classB; classB.C = classC; classC.A = classA; char choice; do { Console.WriteLine("1. Custom serialization \n" + "2. Custom deserialization \n" + "3. Json serialization \n" + "4. Json deserialization \n" + "5. Finish \n"); choice = Console.ReadKey().KeyChar; Console.ReadLine(); switch (choice) { case '1': //CUSTOM serialize string filePath1 = Directory.GetCurrentDirectory() + "\\customSerialized.txt"; CustomSerializer serializer1 = new CustomSerializer(); using (FileStream fileStream = new FileStream(filePath1, FileMode.Create)) { serializer1.Serialize(fileStream, classA); } Console.WriteLine("\nSerialized to: " + filePath1); break; case '2': //CUSTOM deserialize string filePath2 = Directory.GetCurrentDirectory() + "\\customSerialized.txt"; CustomSerializer serializer2 = new CustomSerializer(); using (FileStream fileStream = new FileStream(filePath2, FileMode.Create)) { serializer2.Serialize(fileStream, classA); } CustomSerializer deserializer = new CustomSerializer(); ClassA result2 = null; using (Stream stream = File.Open(filePath2, FileMode.Open)) { result2 = (ClassA)deserializer.Deserialize(stream); } Console.WriteLine("\nDeserialized (CUSTOM): \n" + result2 + "\n" + result2.B + "\n" + result2.B.C + "\n"); break; case '3': //JSON serialize string filePath3 = Directory.GetCurrentDirectory() + "\\jsonSerialized.json"; JsonSerializer jsonSerializer3 = new JsonSerializer(); using (FileStream fileStream = new FileStream(filePath3, FileMode.Create)) { jsonSerializer3.JsonSerialize(fileStream, classA); } Console.WriteLine("\nSerialized to: " + filePath3); break; case '4': //JSON deserialize string filePath4 = Directory.GetCurrentDirectory() + "\\jsonSerialized.json"; JsonSerializer jsonSerializer4 = new JsonSerializer(); using (FileStream fileStream = new FileStream(filePath4, FileMode.Create)) { jsonSerializer4.JsonSerialize(fileStream, classA); } ClassA result4 = null; result4 = (ClassA)jsonSerializer4.JsonDeserialize(filePath4); Console.WriteLine("\nDeserialized (JSON): \n" + result4 + "\n" + result4.B + "\n" + result4.B.C + "\n"); break; case '5': Environment.Exit(0); break; } Console.WriteLine("\nPress ENTER to continue..."); Console.ReadLine(); Console.Clear(); } while (choice != '5'); Console.ReadLine(); }
public ClassA(ClassB b) { this.B = b; }
static void Main(string[] args) { /* * Jagged array example. * differs from multidimensional array because * it does not require 'square' lengths. */ Console.WriteLine("Jagged Array Example"); int[][] jaggedArr = new int[3][]; jaggedArr[0] = new int[2] { 1, 2 }; jaggedArr[1] = new int[5] { 1, 4, 5, 7, 1 }; jaggedArr[2] = new int[3] { 5, 8, 1 }; for (int i = 0; i < jaggedArr.Length; i++) { Console.Write("Element({0}): ", i); for (int k = 0; k < jaggedArr[i].Length; k++) { Console.Write("{0} ", jaggedArr[i][k]); } Console.WriteLine(); } /* * Multidimensional array example. * Array specifies 4 arrays with 2 in each. */ Console.WriteLine("\nMultidimensional Array Example"); int[,] multiArr = new int[4, 2] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; // A similar array with string elements. string[,] stringArr = new string[3, 2] { { "one", "two" }, { "three", "four" }, { "five", "six" } }; // Array printing in order. foreach (int i in multiArr) { Console.Write(i); } Console.WriteLine(); /* * Boxing and unboxing example * useful for 'unified type system' * easy to use, remember this. */ //Console.WriteLine("\Boxing + Unboxing Example"); int x = 5; // Boxing the int object box = x; // Unboxing the int int y = (int)box; /* * Dynamic type example * A keyword used to declare variable when you do not * know value type */ Console.WriteLine("\nDynamic Type Example"); dynamic d = 2; d = 2.5; Console.WriteLine(d); /* * is operator example. * Tests if obj a certain class. */ Console.WriteLine("\n'is' Operator Example"); UselessObj myObj = new UselessObj(); if (myObj is UselessObj) { Console.WriteLine("'is' operator is working!"); } else { Console.WriteLine("'is' operator isn't working :("); } // This test works, however VS // gives green underlines, so // keep in mind there is a more // elegant solution double myInt = 1.1; if (myInt is int) { Console.WriteLine("yea"); } else { Console.WriteLine("no"); } /* * as operator example. * used as a type converter */ Console.WriteLine("\nas Operator Example"); object[] objArray = new object[6]; objArray[0] = new ClassA(); objArray[1] = new ClassB(); objArray[2] = "hello"; objArray[3] = 123; objArray[4] = 123.4; objArray[5] = null; for (int i = 0; i < objArray.Length; ++i) { string s = objArray[i] as string; Console.Write("{0}:", i); if (s != null) { Console.WriteLine("'" + s + "'"); } else { Console.WriteLine("not a string"); } } } // end main
public ClassC(ClassB <ClassA> ba) { }
public static void TestConstructorOptionalParameter() { ClassB obj = new ClassB(); Assert.AreEqual("classB", obj.GetFieldA()); }
public void functionB() { ClassB b = new ClassB(); b.doSomething(); }
public void CallB() { ClassB.MyMethod(this); }
public PrincipleClass(string db_file) { InstanceOfClassA = new ClassA(new SQLiteConnection(db_file)); InstanceOfClassB = new ClassB(); }
public void DoSomething() { var classB = new ClassB(); }
public ClassA(ClassB classb, string name) { this.classb = classb; this.name = name; }
public InheritanceAndPolymorphismV2_5() { ClassA a = new ClassB(); a.XXX(); }
public void GetConstValue(ClassB obj) { //todo: contract validations obj.SetConstValue(MyConst); }
public ClassA() { B = new ClassB(); C = new ClassC(); }
public ClassD(ClassB <IClassA> ba) { }
private void testStruct(ClassB b) { }
public ClassA(ClassB B) { this.B = B; }
public static int AddB(int a, int b) { return(ClassB.Add(a, b)); }
public void Method(ClassB p1, ClassB p2, ClassB p3) { SetLastCall(MethodBase.GetCurrentMethod(), p1, p2, p3); }
public MyB(ClassB actualB) { _actualB = actualB; }
public void TestExplicitCast() { ClassB classB = (ClassB) new ClassA(1); Assert.AreEqual(1, classB.Value); }
public ClassA() { InstanceOfClassB = new ClassB(); }
// chain to another, 'simpler' constructor by doing : this(name, age) public ClassA(string name, int age, ClassB classB) : this(name, age) { this.ClassB = classB; }
private void btnAuthorizationA_Click(object sender, RoutedEventArgs e) { txtAuthorizationA.Text = String.Empty; SLPrincipal.Logout(); SLPrincipal.Login("TestUser", "1234", "ClassARole;PropertyARole", (o, e2) => { bool pass = true; try { ClassA classA = new ClassA(); classA.A = "test"; classA.B = "test"; if (classA.A != "test" || classA.B != "test") { pass = false; } if (!pass) { throw new Exception(); } ClassA.Fetch((o3, e3) => { try { if (e3.Object == null || (e3.Object.A != "test" && e3.Object.B != "test")) { pass = false; } ClassB classB = new ClassB(); classB.A = "test"; classB.B = "test"; if (classB.A != "test" || classB.B != "test") { pass = false; } if (pass) { txtAuthorizationA.Text = "Pass"; } else { txtAuthorizationA.Text = "Fail"; } } catch (Exception ex) { txtAuthorizationA.Text = "Fail"; } }); } catch (Exception ex) { pass = false; } }); }
private void PrintB(ClassB e) { Debug.Log("Event B"); }
// Open generic private class ClassA { public ClassA(ClassB cb) { }
private class ClassE { public ClassE(ClassB cb) { }
public C(ClassA a, ClassB b) { this.A = a; this.B = b; }
public ClassA(ClassB b) { }
public virtual void SetClassb(ClassB classb) { this.classb = classb; }
public void MethodInfoAdviceClassB_MethodB() { Expected = 2; ClassB.Method(); // fails Assert.AreEqual(0, Expected); }