Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Collection_ Introduction default constructor rule_accessing methods from object returned from property
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class MyClass { private string _Field1; public MyClass():this("Hi Rextester!!!"){} public MyClass(string s) { _Field1=s; } public string PropertyOne { get{return _Field1;} set{_Field1=value;} } } public class GenericFactory<T>where T:new() { public static GenericFactory<T> factory; public static GenericFactory<T> Instance { get { if(factory!=null) return factory; else { factory=new GenericFactory<T>(); return factory; } } } public T NewObject() { return new T(); } } public class Program { public static void Main(string[] args) { MyClass mc1=GenericFactory<MyClass>.Instance.NewObject(); MyClass mc2=GenericFactory<MyClass>.Instance.NewObject(); MyClass mc3=GenericFactory<MyClass> Console.WriteLine(mc1.PropertyOne); Console.WriteLine(mc2.PropertyOne); Console.WriteLine("------------------------------------------------"); mc1.PropertyOne="Different Rextester"; Console.WriteLine(mc1.PropertyOne); Console.WriteLine(mc2.PropertyOne); } } }
run
|
edit
|
history
|
help
0
array reverse
binary search tree reversal
I know it's a bit combersome, but it's my first attempt.
Working with Dictionaries (csharp)
Full text search using Linqdb
lala
tax cal
Mintra url string replace
sdfrgthyju8765rb dcd vxs dd
Events