|
Oh ok great Thanks to spend time with me.
Regards,
Hogan
|
|
|
|
|
ArrayList is something we used back in the old days before .NET got the necessary features to build collections. It's still there to support old code, but it's not something you should use for anything.
The current collections are based on Generics and are much better (still severely lacking, but evetything they lack ArrayList lacks as well). You will find them in System.Collections.Generics.
Using an Array for something where the size isn't static is inefficient - both to code and for the computer to execute. There is no excuse for it, it is simply not something you should ever do.
The bottom line is that this is not a choice between an Array or an ArrayList - neither should be used in this case. Use System.Collections.Generic.List<t>
|
|
|
|
|
Thats another wonderful idea. Thank you buddy.
Regards,
Hogan
|
|
|
|
|
lmoelleb wrote: still severely lacking, but evetything they lack ArrayList lacks as well
for example....
|
|
|
|
|
Events. These are critical to build ANY form of GUI on top of your domain model and they can be critical within the domain model itself as well. For example, how would you know you needed to write a new item to the database when it is added to the collection in the domain model if you do not get an event when it is added. Sure you can write your own collection class for it, but it is really something I would expect the framework to provide.
They did add the BindableList and ObservableCollection (in .NET 3.0). ObservableCollection is as such OK, but:
1) Why do we have two implementations of a list collection with events, and no events on any other collection type?
2) Why are they separate in the first place? Just add the events to the standard collections and be done with it.
|
|
|
|
|
Seems like you are vigilant to upgrade your knowledge. Can you please refer me any articles or links which describe what is new in Framework 2.0 and 3.0?
Regards,
Hogan
|
|
|
|
|
OK, fine - but I still wouldn't call that "severely lacking". You've given an example of only 1 thing that is missing from one particular use case of a List (of which there are thousands of use-cases which don't require events)
I can't say that im familiar with what you mean by "domain model", but ive used List and the other collection classes countless thousands of times without ever having the need for them to raise events when I add/remove items.
|
|
|
|
|
"Severely lacking" is pretty accurate, but a bit on the mild side. "Pathetic" is another description that springs into mind.
It does not matter how many things are missing, it matters how important the missing things are. If I gave you a collection that could do EVERYTHING except one small detail: You could never add items to it - would you then like it because it only missed one single fundamental feature?
The user case I gave are:
1) Build a user interface.
2) Persist data.
I will at any time claim that these use cases are so fundamental that it doesn't really matter it's only two (that I came up with, it's not like its the only usecases - basically you need events every single time data change).
If you are not familier with Domain Models and Observer Pattern (you might simply call it something else - Google it and see if you recognize it) you might indeed not know how badly it is missing. The Big Ball of Mud pattern works just fine without events as you can compensate for it by adding even more spaghetti code.
|
|
|
|
|
Well Observer I know well, but its rarely my collection of objects that has the observer. I guess its just a different style I use.
Still can't see how a simple object for "holding a collection of items" is severely lacking though As far as im concerned, it has Add/Remove/Count which is exactly what I think it should have. Again, just a different way of dealing with it I guess.
|
|
|
|
|
Yes, if you just think of collections at that abstraction level you do indeed not need any events... but a framework shouldn't support lowest abstraction level only.
|
|
|
|
|
lmoelleb wrote:
They did add the BindableList and ObservableCollection (in .NET 3.0). ObservableCollection is as such OK, but:
.NET 2.0 has BindingList<>. I'm using it in an application at the moment, which is the only reason I know that
"If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual."
- Frank Herbert
|
|
|
|
|
Yes, that was the one I ment - I just got the name wrong as I haven't touched it since 3.0 was released. The way it forces sorting on a collection simply does not make sense in a lot of cases - as not all collections can be sorted, and those that can might not have a property you can set to determine how it is sorted.
|
|
|
|
|
I think that feature is not get in C#.Please use arraylist.
Continue...
|
|
|
|
|
What is it with this sadistic desire to try to convince people to use the obsolete ArrayList class? Are people really still using .NET 1.1?
|
|
|
|
|
I'm using the following code to download the file group called Module1.
if ( ApplicationDeployment.IsNetworkDeployed )<br />
{ <br />
<br />
ApplicationDeployment.CurrentDeployment.DownloadFileGroup ("Module1");<br />
}
It works fine for first time.. but It doesn't download for second time.
For example: I have deployed my application version 1. There are four dlls in that application. I divided those dlls into two groups (Module1 and Module2) as below.
MyApplication (version : 0.1)
- Module1
----mydll-1.dll (version : 0.1)
----mydll-2.dll (version : 0.1)
- Module2
----mydll-3.dll (version : 0.1)
----mydll-4.dll (version : 0.1)
Then, I installed myapplication (version 0.1) on client's machine. it works fine. It downloaded "Module1" by using this code " ApplicationDeployment.CurrentDeployment.DownloadFileGroup ("Module1");".
The problem started when I wanna update something in my existing dlls. I updated something in "mydll-1.dll" under "Module1". After that, I remove "mydll-1.dll.deply" file from ClickOnce deployment folder. and I put my new dll "mydll-1.dll (version : 0.2)" in that folder. I resign the manifest file by using mageui.exe tool.
I launch the application on client's machine but the Module1 is not downloaded. So, I don't get the latest versin of "mydll-1.dll (version : 0.2)".
My question is "How to download the filegroup by force at anytime I wish?"
Thanks in advance.
|
|
|
|
|
hi,
in this simple code my program is not going into "area = r * r * 3.14;"
the output i am getting is 0000
{
class ReturnTest
{
static int r;
static double area;
static double CalculateArea()
{
Console.WriteLine("the value of r is ", r);
Int32.Parse(Console.ReadLine());
area = r * r * 3.14;
return area;
}
static void display()
{
Console.WriteLine("The area is {0 .00}", area);
Console.ReadLine();
}
public static void Main()
{
ReturnTest.CalculateArea();
ReturnTest.display();
}
}
}
can you tell me why???
thanks for the help
j
|
|
|
|
|
Trustapple wrote: Int32.Parse(Console.ReadLine());
you are converting the string value into int but you are not assigning to any variable for that reason you are getting value as 0 as r value is 0
i think your statement should be like......
r = Int32.Parse(Console.ReadLine());
Regards,
Sandeep Kumar.V
|
|
|
|
|
ThankYou Sandeep ....i am a beginner hence the confusion
|
|
|
|
|
Is there a code or object you put into you're program so that you can have a media player in you're program.
I mean, a media player that when you push a button it auto feeds to a site and relays the movie straight to the player.
Also, how do i make the window not move able, as in click on the bottom right corner and adjusting the size. I want to make it so it's just the media window and nothing else, not being able to be resized.
-- modified at 23:36 Tuesday 16th October, 2007
Ohh while i'm thinking about it, is there a way to make a tab window open on like the left side of the program and allow you to click a button to switch the media player to another?
I've seen it on other programs, if any one has used X-fire thats what i mean, in a way. But, Is that possible in C#, or is that a special code thats uncompliable?
|
|
|
|
|
Yes, the wndows media player is built in, you just need to add it to the toolbox if it's not there already.
Yes, you can put a tab anywhere you list. Not sure what you mean by switching media player, but I'd guess the answer is yes. C# can do anything C++ can do, as it can p/invoke C++ if it doesn't have APIs to do it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Hi,
If i want to perform a search using the function SelectNodes(), can i specify an XPath to search for the node's value instead of the node's name?
Thanks
|
|
|
|
|
yes, you use = to specify a value.
"/XML/value[@attrib='this']"
That returns nodes under XML/value that have an attribute ( that's what the @ means ) named this.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Dear all
i'm a student working on a project that i have to deliver real soon and i'm running out of time
my project includes building a graph for web pages of my site and compute connected components
so i'll have to work with connected components algorithm or incremental connected components
i found quick graph library in this site but i have difficulty working with it
in building the graph
i want to add vetrices to the graph dynamically
as select page names from database table and add it to the graph
as i got when working with adjacency graph i write
VertexStringDictionary names as new VertexStringDictionary
IVertex u = g.addvetrex();
names(u) = "u"
but what if i want to use an iteration for table records as name for IVertex dbvalue = g.addvertex
then names(dbvalue)= "dbvalue"
then what can i do after that to apply connected components algorithm
please help me urgently i'm in bad need for help
accept all my regards
|
|
|
|