473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Why is the Pair class in a UI namespace?

Can anybody tell me why MS would put such a basic data structure, like
System.Web.UI.Pair, into a UI namespace?

The Pair class, to me, is something you use just as much at a deeper level
as you would at the UI level..

But I can only assume the namespace of each .NET class was well thought out
and put there for a reason I can't comprehend. So what the hell am I
missing? Or did somebody just throw it into the wrong namespace?

Thanks in advance,
John
Nov 22 '05 #1
4 1979
I would assume that it is available higher up since it could be used as
a fairly generic data structure.

Why burry a generic class down into the depths of a namespace tree if
several classes/methods could use it either directly or indirectly.

MSDN has a small example of its use:

public ICollection GetFilesToProcess(DirectoryInfo directory) {

ArrayList filesAndAttributes = new ArrayList();

foreach (FileSystemInfo fsi in directory.GetFileSystemInfos())
{
if( fsi is FileInfo ) {
string name = fsi.FullName;
FileAttributes attr = fsi.Attributes;
Pair p = new Pair ();
p.First = name;
p.Second = attr;
filesAndAttributes.Add(p);
}
}

return filesAndAttributes;
}

I guess it would be just as easy to do it other ways, but the Pair
class offers a simple way to designate a generic two property class.

Nov 22 '05 #2

"gmiley" <gm****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I would assume that it is available higher up since it could be used as
a fairly generic data structure.

[snip]

It is available, as long as I include a reference to system.web.dll in my
model assembly.

Basically, the way I code is I write a model assembly with all the business
level coding and db interaction. Then I write the asp pages using the model
assembly. The benefit is that I can reuse the model assembly in other
places like maybe a future webservice or something ... who knows.

So obviously, I don't want to tie my model assembly to the system.web.dll.
And that's the only way to reference it ... that I know of anyway.

The best course of action is to rewrite the simple class ... but I just feel
foolish rewriting something that's already there!

As I said earlier, I can only assume I'm missing something.

Thanks,
John
Nov 22 '05 #3
I see, I misunderstood your first post. I am not sure why something as
basic as the Pair class would be down in Web.UI - I would think it
should be in System.Collections{} or System.Collections.Specialized{}.

Regardless, as redundant as it is:

public class Pair : System.Object
{
public object First;
public object Second;

public Pair() {}
public Pair(object first object second)
{
First = first;
Second = second;
}
}

Nov 22 '05 #4

"gmiley" <gm****@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I see, I misunderstood your first post. I am not sure why something as
basic as the Pair class would be down in Web.UI - I would think it
should be in System.Collections{} or System.Collections.Specialized{}.

Regardless, as redundant as it is:

public class Pair : System.Object
{
public object First;
public object Second;

public Pair() {}
public Pair(object first object second)
{
First = first;
Second = second;
}
}


Thanks but I already created (duplicated) it.

Honestly, the more I think about it ... the more I think it wasn't planned,
but just thrown into the namespace it was being used for what ever project
at MS.

If anybody has a comment on why it might logically be there ... I'd love to
hear it.

Sincerely,
John
Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Neil Zanella | last post by:
Hello, I would like to ask how come the design of C++ includes std::pair. First of all I don't think many programmers would use it. For starters, what the first and second members are depends...
8
by: Valery | last post by:
hi All, how to make a member function, which is virtual not for a single object, but for the *pair* of objects?.. Here goes the skeleton of the code, which should ideally print "ABCD":...
3
by: JustSomeGuy | last post by:
in the stl map class I see the use of a function pair and make_pair. What is the difference between pair and make_pair? dictionary.insert(std::pair<Key, Value>(k,v)); works as well as: ...
4
by: John | last post by:
Can anybody tell me why MS would put such a basic data structure, like System.Web.UI.Pair, into a UI namespace? The Pair class, to me, is something you use just as much at a deeper level as you...
4
by: Florent Garcin | last post by:
Hello! I would like to use the map structure with a key of Pair<string, string> and an int as the value. Pair is defined as: template <class T1, class T2> class Pair {
4
by: onkar | last post by:
#include<iostream> using namespace std; int main(void){ const pair<const char*,const char*arr={ pair<const char*,const char*>("1","1"), pair<const char*,const char*>("12","12"), pair<const...
2
by: razael1 | last post by:
#include <utility> #include <vector> using namespace std; vector< pair<int,int v; Generates an error: ISO C++ forbids declaration of 'vector' with no type
6
by: sandy | last post by:
I think I just need a pair of eyes here... I can't see what I am doing wrong. I am creating a new Class for an assignment, Class File. I have a header and a cpp file. When I try to write the...
18
by: subramanian100in | last post by:
Consider a class that has vector< pair<int, string>* c; as member data object. I need to use operator>to store values into this container object and operator<< to print the contents of the...
1
by: subramanian100in | last post by:
consider the program: #include <cstdlib> #include <iostream> #include <utility> using namespace std; class Test {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.