can we use two diffrent namespaces
-
hi, can we use two diffrent namespaces one after another within a single C# programs, for example something like following code..
Using system1; //namespace1 Using system2; //namespace2 namespace custom_namespace { class myclass { // code here } }
Is it possible????????? thanks to you all nagarajuepuri -
hi, can we use two diffrent namespaces one after another within a single C# programs, for example something like following code..
Using system1; //namespace1 Using system2; //namespace2 namespace custom_namespace { class myclass { // code here } }
Is it possible????????? thanks to you all nagarajuepuriYou mean like this:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;namespace Number_Puzzle_Cs
public class frmMain : System.Windows.Forms.Form
{...Of course it is! Have you looked at the top of your Form code after creating a new Windows Form project? By default, it uses 6 namespaces:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace WindowsApplication5
RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
You mean like this:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;namespace Number_Puzzle_Cs
public class frmMain : System.Windows.Forms.Form
{...Of course it is! Have you looked at the top of your Form code after creating a new Windows Form project? By default, it uses 6 namespaces:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace WindowsApplication5
RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Thanks a lot, actually i am writing my C# code in notepad then i am compiling that code through command prompt. thanks once again nagarajuepuri
-
Thanks a lot, actually i am writing my C# code in notepad then i am compiling that code through command prompt. thanks once again nagarajuepuri
Yuk! But it's free, so I guess it's worth it! ;) RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Thanks a lot, actually i am writing my C# code in notepad then i am compiling that code through command prompt. thanks once again nagarajuepuri
Not very pretty but as was pointed out, it works. If you can't afford VS.NET or don't want to buy it may I humbly suggest Sharp Develop[^]. It's a free .NET development enviroment. I haven't used version 1 or whatever they are up to now but I did use it back in the .6 or .5 days and it was pretty good. Just a suggestion and it is free (both the suggestion and the app). -Richard
-
hi, can we use two diffrent namespaces one after another within a single C# programs, for example something like following code..
Using system1; //namespace1 Using system2; //namespace2 namespace custom_namespace { class myclass { // code here } }
Is it possible????????? thanks to you all nagarajuepuriHi Dear, You can use a lot of namespaces if you want, but you must note that if there are two classes with the same name in two namespaces, You must write full address of your classs in your source code: For example: Suppose that you have two class with the name of Class1 in two namespaces (namespace1, namespace2) so if you want to use these class in your source code, You must write:
Public Class2
{
public void SomeFunction()
{
namespace1.Class1 object1 = ...;
namespace2.Class1 object2 = ...;
}
}I hope these notes be enough for you. Dariush Tasdighi http://www.IranianExperts.com Web Master
-
Thanks a lot, actually i am writing my C# code in notepad then i am compiling that code through command prompt. thanks once again nagarajuepuri