473,326 Members | 2,813 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,326 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 1971
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.