0
For the namespace can you put anything there
3 odpowiedzi
+ 1
onusomto If you found my response helpful, can you mark it as an answer? Thanks!
+ 2
Yes, a namespace defines "where" the script is stored in a library. If I define my namespace like this...
using System;
namespace Foo {
public static class Bar {
public static string myVar = "Hello World";
}
}
In other scripts in order to use it you have to define the namespace (using the "using" header) or use the namespace embedded in the code (not recommended)
Ex
using System;
using Foo; // That namespace
public static Program {
public static void Program(string[] args) {
Console.WriteLine(Bar.myVar); // This will work because we defined the namespace
Console.WriteLind(Foo.Bar.myVar); // This will also work but it is lengthy and it is better to define the namespace if you are going to use it more than once
}
}
0
Ok thank you