There are many namespaces in C# for example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
I know System namespace eliminates need to have System name in every WriteLine() method. I wish to know is there any technique to decide appropriate name space for a program. Is there any articles about this?
Loading
Sam HobbsPosted Dec 5, 2011, 6:09 PM
VulpesPosted Dec 5, 2011, 5:55 PM
The program should then build and run.
Posted Dec 5, 2011, 4:40 PM
public class Example
{
public static void Main()
{
BigInteger[] values = { 2, 100, BigInteger.Pow(2, 64) };
foreach (var value in values)
Console.WriteLine(Math.Exp(BigInteger.Log(value) / 2));
}
}
VulpesPosted Dec 5, 2011, 3:24 PM
Posted Dec 5, 2011, 12:22 PM
VulpesPosted Dec 5, 2011, 11:28 AM
I didn't know that and I'm sure it will be useful to Maha :)
Satish BhatPosted Dec 5, 2011, 7:02 AM
VulpesPosted Dec 5, 2011, 4:41 AM
http://msdn.microsoft.com/en-us/library/ms132397.aspx
To be able to write a C# program in a reasonable amount of time, you need to have a familiarity with the C# language itself and at least the basic framework namespaces and classes. Armed with that knowledge, you can usually find anything else you may need from the documentation (or by googling) as types which have related functionality tend to be grouped in the same namespace.
Sam HobbsPosted Dec 4, 2011, 11:18 PM
Posted Dec 4, 2011, 11:07 PM
using System;
using System.Collections.ObjectModel;
Suppose I have to write this program from scratch how to decide what are the namespaces I have to use.
using System;
using System.Collections.ObjectModel;
class ConverterCollection
{
private Converter
public ConverterCollection(Converter
{
this.convert = convert;
}
protected override void InsertItem(int index, T item)
{
base.InsertItem(index, convert(item));
}
}
public class MainClass
{
public static void Main()
{
ConverterCollection
delegate(string s) { return s.ToUpper(); });
c.Add("Hello");
c.Add("World!");
foreach (string s in c)
Console.WriteLine(s);
}
}
Sam HobbsPosted Dec 4, 2011, 9:10 PM
Namespace: System
VulpesPosted Dec 4, 2011, 5:12 PM
If you just want to know what namespace a framework type belongs to then, as Sam, says you need to consult the MSDN documentation. This will also tell you what dll it's in, in case you need to add a reference to that dll as well as a 'using' directive for the namespace.
Posted Dec 4, 2011, 5:06 PM
Sam HobbsPosted Dec 4, 2011, 4:53 PM
Posted Dec 4, 2011, 10:49 AM
VulpesPosted Dec 4, 2011, 10:02 AM