|
Is not allowed to modify any item of a collection in any way while you're inside the foreach loop on that collection.
You may try to lock the piece of code, something like the following
lock(this) {
...
}
paco
|
|
|
|
|
Thank you carlopagliei for the reply; but i am not using the foreach statement. I have a code like
ddlTest.DataSource= TestCollection;
ddlTest.DataBind();
Otherthan populating the collection from database, i am not manipulating the collection.
|
|
|
|
|
It was only an example. You don't use foreach but probably the problem is that while DataBind() method enumerates over the TestCollection another piece of code (maybe the same but from another thread) is doing the same. So try to lock the code that acess TestCollection before use it:
lock (TestCollection) {
ddlTest.DataSource= TestCollection;
ddlTest.DataBind();
}
paco
|
|
|
|
|
Hi.
when we create a class, and in code type 'ClassName.', some methods and properties appear, and on an object of that class there is another properties and methods.
first : we don't write them for that class, these properties and methods come from where?
second : for class and object these are difference, why?(Is it for static methods and properties?)
Best wishes
|
|
|
|
|
mehrdadc48 wrote: first : we don't write them for that class, these properties and methods come from where?
Are you referring to methods such as ToString()? They would be inherited from the base class (in this case, System.Object).
mehrdadc48 wrote: second : for class and object these are difference, why?(Is it for static methods and properties?)
You are correct. You cannot call static methods using an object instance.
Cheers,
Vikram.
I don't know and you don't either.
Militant Agnostic
|
|
|
|
|
Typing "Classname." invokes intellisense which lists the properties and methods of that class or object so as to ease the work of a prorgammer so he/she does not have to remember all the properties and methods of the Dot Net Framework. There are many classes built into the Dot Net Framework, many of which wrap commonly used functionality that already exists in Windows. In summary, these classes and intellisense are there to make a programmer more productive and are part of the Dot Net Framework installed on your computer.
As for the difference between the methods displayed by Classes and Objects; Yes you are right that for Classes, only static methods are displayed unlike Objects.
|
|
|
|
|
Hi. I have a rss, and I want to remove the items that its pubDate are lower than a DateTime. The problem is that I can't use the function to compare date in XPath because the pubDate use the RFC-822 format and the function in XML/XSD/XSLT, use ISO-8601 format. So I have to use an external function to remove the nodes like this:
public static XmlDocument XMLFilter(XmlDocument doc, DateTime aDate)
XPathNavigator nav = doc.CreateNavigator();
DateTime nodeDate;
foreach (XPathNavigator node in nav.Select("rss/channel/item/pubDate")) {
nodeDate = DateTime.Parse(node.Value).ToLocalTime();
if (nodeDate.CompareTo(aDate.ToLocalTime()) < 0) {
node.DeleteSelf();
}
}
return doc;
}
But If I return the doc, the element are not removed. I want to remove that node (where I compare the condition node.DeleteSelf())
Thanks a lot !!!!!
|
|
|
|
|
Heyyy, I found the way !!! . Thanks anyway people !! May be this solution could help somebody, like me !!
public static XmlDocument XMLFilter(XmlDocument doc, DateTime aDate)
{
DateTime nodeDate;
XmlNode nodeChannel = doc.SelectSingleNode("rss/channel");
XmlNodeList pudDateNodeList = doc.SelectNodes("rss/channel/item/pubDate");
foreach (XmlNode node in pudDateNodeList){
nodeDate = DateTime.Parse(node.InnerText).ToLocalTime();
if (nodeDate.CompareTo(aDate.ToLocalTime()) < 0) {
nodoChannel.RemoveChild(node.ParentNode);
}
}
return documento;
}
|
|
|
|
|
Hi.
I use Flash player component in my project.
How can I close right click on Flashes that it plays.
It don't have click event.
Best wishes
|
|
|
|
|
Hi.
When take right click on solution name in solution explorer, a choice is 'build solution', and another is 'Rebuild solution'.
What is the difference between them ?
Best wishes
|
|
|
|
|
Build just works on modified files, Rebuild deletes all object files etc, and does everything. I think.
Regards,
Rob Philpott.
|
|
|
|
|
Exactly. Build only builds the projects that has files that has changed since last build. Rebuild makes a complete build of the entire solution.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: Build only builds the projects that has files that has changed
And one has to be careful with this. For example Visual Studio won't notice any changes made to resx files and won't build it until explicitely rebuild has been clicked.
|
|
|
|
|
Hi
How i can drow on web pleas give some exmple.
than'k
|
|
|
|
|
Be more specific, on web pages may be JS help.
------------------------------ "The Soapbox has been so ..."
|
|
|
|
|
If you want the user to be able to draw on a webpage and you save it, the only technologies I can think of which may let you do this are:
Applets (using Java)
and
Flash
Kind regards - Jakob
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
Ok but i don't know how to insert some flash movie on my web please help me with that.
|
|
|
|
|
Hi,
I am working on a VoIP application. I retrieve voice streams from a MIC. Now I would like to apply an audio codec (G711 or G729) on these streams.
I don't know where to start ...
Has someone an idea ?
Thanks in advance
Guillaume
Guillaume
http://www.ece.fr/~gbonnet
|
|
|
|
|
I haven't worked on a project like this myself, so this might be a complete red herring - but I think the Windows Media Encoder SDK:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmencode/htm/aboutthewindowsmediaencodersdk.asp
should be helpful.
-- modified at 18:14 Tuesday 16th May, 2006
Here's a link specifically for us CSharpers:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmencode/htm/creatinganencoderapplication.asp
|
|
|
|
|
HI,
Thanks for that. I will have a look at it.
Bye
Guillaume
http://www.ece.fr/~gbonnet
|
|
|
|
|
The link you sent is very good if you want to apply a codec that you "create" on your own. Thanks.
Although I would like to use an standard codec such as g711. So I have to look at something else.
I found that SUN release the code public :
Cpp : http://www.koders.com/cpp/fid45CC4E8F93239756E0CD455477269712A825C1E9.aspx
C: http://www.koders.com/c/fidCB98985908407980C619193ED46BC31B0535D651.aspx?s=g711.c
So I should be able to do something.
Regards
Guillaume
Guillaume
http://www.ece.fr/~gbonnet
|
|
|
|
|
Hi All,
I'm currently messing with strings, and need your advice on how to do this more efficiently.
Some of the data I deal with comes as a huge line of text (2000 characters per record, approx 1000+ records per file... it's a bad system, but hey it's *worked* since 1986, apparently).
Now I need to be able to update certain segments of each record with new data, so I thought there must be some kind of .Net String replace method allowing you to specify a start and length of the characters you want to replace...
... only I haven'y found it yet! Instead, I'm having to cast each record out as a char[] and update each array element individually.
This works - but I suspect I must be missing a trick here, so does anyone know the proper way to do it?
Cheers,
Martin.
|
|
|
|
|
string test = "Paul Brower" ;
test.Replace("Paul","David") ;
//test now = "David Brower"
... go from there
|
|
|
|
|
Paul Brower wrote: test.Replace("Paul","David") ;
Just an oversight, I'm sure, but you need to assign the return value of all string methods to actually get the new value...
test = test.Replace("Paul", "David");
Normally I wouldn't point out such things, but since this is a "how do I use strings in .NET" question, I felt obliged to clarify.
Josh
|
|
|
|
|
No, there is no method for replacing a segment of a string, but it's easy to make one:
public string ReplaceSection(string data, int pos, string replacement) {
return data.SubString(0, pos) + replacement + data.SubString(pos + replacement.Length);
}
You might want to add some error checking to it, also.
---
b { font-weight: normal; }
|
|
|
|