Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Namespaces multiple
//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; using Example.NameSpaceExample; using NameSpaceExample2; namespace Example { namespace NameSpaceExample { class CountDown { int val; public CountDown(int n) { val = n; } public void Reset(int n) { val = n; } public int Count() { if(val > 0) return val--; else return 0; } } } } namespace NameSpaceExample2 { class CountDown { int val; public CountDown(int n) { val = n; } public void Reset(int n) { val = n; } public int Count() { if(val > 0) return val--; else return 0; } } } namespace Rextester { public class Program { public static void Main(string[] args) { // Notice how CountDown is qualified by Counter. //NameSpaceExample.CountDown cd1 = new NameSpaceExample.CountDown(10); Example.NameSpaceExample.CountDown cd1=new Example.NameSpaceExample.CountDown(10); int i; do { i = cd1.Count(); Console.Write(i + " "); } while(i > 0); Console.WriteLine(); // Again, notice how CountDown is qualified by Counter. Example.NameSpaceExample.CountDown cd2 = new Example.NameSpaceExample.CountDown(20); do { i = cd2.Count(); Console.Write(i + " "); } while(i > 0); Console.WriteLine(); cd2.Reset(4); do { i = cd2.Count(); Console.Write(i + " "); } while(i > 0); Console.WriteLine(); } } }
run
|
edit
|
history
|
help
0
world
C# URI parts url
Plt-D v.0.9 WOA
23
Linq join to tables
30272 Example2
Plt-D v.0.9.1
Main4
line 1 syntax error
Test