static TestRandoPort() { if (_instance == null) { lock (objLock) { if (_instance == null) { _instance = new TestRandoPort(); } } } }
private static void TestType() { string TypenName = System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.FullName; TypenName = System.Reflection.MethodBase.GetCurrentMethod().Name; Type type = typeof(Program); Console.WriteLine(TypenName); TestRandoPort obj = Activator.CreateInstance(typeof(TestRandoPort)) as TestRandoPort; Console.WriteLine(obj.PortIsUsed().Count); }