|
DaveyM69 wrote: f matching multiple properties then it's not much use.
Then just make a key that contains multiple properties. Make a class that implements IEqualityComparer and use that as comparer when you create the dictionary.
DaveyM69 wrote: That code performs 10 to 20% quicker than a foreach!
Hm... that's pretty strange, as all the Find method does is looping through the items and calling the delegate...
A dictionary would perform about 100000% faster...
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
DaveyM69 wrote: If matching multiple properties then it's not much use.
Regarding that, I wrote an article about how to make a custom key for a dictionary:
Dictionary with a custom key[^]
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Hi,Please tel me how I can scan a document in c#.thanks.
Chamanara Shapoor
|
|
|
|
|
Member 2671314,
What do you mean by "scan a document"?
Regards,
Gareth.
|
|
|
|
|
I would assume you want to loop through the text of the entire document for single terms/phrases. Just use a for loop or while(!stream.endoffile).
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Buy an OCR toolkit and hook it in, or look at writing a TWAIN class. There should be some samples floating around that you could work from.
|
|
|
|
|
Hi,
thanks.twain?where i can find this?
Chamanara Shapoor
|
|
|
|
|
I want to convert an RGB Image to YCrCb Image. when i get the values for Y,Cr and Cb for every pixel Using Its RGB Values... what am i supposed to do with these values to get The Resultant Image ?
(Jameel)
|
|
|
|
|
i want help,because my program is not working properly.If anyone can help me that would be a great help for me.The codings which I tried is given below.
How to print a pyramid?
/using System;
class pyr
{
static void Main(string[] args)
{
int j,k,m;
int n;
Console.WriteLine("No of lines:");
n = Convert.ToInt32(Console.ReadLine());
for (j = 0; j <= n; j++)
{
for (k = 1; k <= n- j; k++)
{
Console.WriteLine("*");
}
for (m = 1; m <= j; m++)
{
Console.WriteLine("*");
}
for (m = 1; m < j; m++)
{
Console.WriteLine("*");
}
}
}
}/
Thanks.
|
|
|
|
|
Why isn't it working properly?
Why do you want to print a pyramid?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
for example i want to print a pyramid like this.
*
***
*****
*******
But it is printing like this
*
*
*
*
*
|
|
|
|
|
Do you know about new line ? ( Like /n in C/C++). If yes then use it.
Regards.
|
|
|
|
|
WriteLine includes a linefeed. You probably want to use just Write
|
|
|
|
|
Part of the reason why your program is not working is that you for statements are not proper or for that matter syntactically correct. Their are only 3 arguments in the for loop, you have extra semi-colons all over your for loops. Along with that I cannot see a correct conditional statement in the for loop (the middle paramter).
Try something along these terms
Console.Write("Enter # of lines:");
int temp=Convert.ToInt32(Console.ReadLine());
for(i=0;i<temp;i++)>
{
for(int j=0;j<=i;j++)
{
Console.Write("*");
}
Console.WriteLine();
}
I did not test this code, but it should work. Since this is your homework assignment you will have to figure out how to line up the asterisks to make a nice pyramid. Right now this should produce a right triangle.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hi,
I have 2 problems with crystal report:
1- when my DB (SQL Server 2005) have userLogin, in each page that a report should be displayed a login form appears for DB user.
2- when my server (connection string) changes, there is no filxed place to change the servername and the reports that is biuld on a server with name 'A' don't work on server 'B', and should be rebuild in new server.
a place such as Settings can not be used for connectionstring??
Best wishes
|
|
|
|
|
hi,
what is the solution of this type error
public class updates<br />
{<br />
public static int b1(int bb)<br />
{<br />
if (ViewState["str3"] == null)<br />
{ bb = 0; }<br />
else<br />
{ <br />
bb = (int)ViewState["str3"];<br />
<br />
<br />
}<br />
bb--;<br />
ViewState["str2"] = bb;<br />
<br />
return bb;<br />
}<br />
}<br />
<br />
protected void Button6_Click(object sender, EventArgs e)<br />
{<br />
l= updates.b1(l);<br />
TextBox3.Text = "" + l;<br />
}
Error 1 An object reference is required for the nonstatic field, method, or property 'System.Web.UI.Control.ViewState.get'
|
|
|
|
|
zeeShan anSari wrote: Error 1 An object reference is required for the nonstatic field, method, or property 'System.Web.UI.Control.ViewState.get'
Your class has no concept of what ViewState is.
You need to obtain a reference to the class that has the ViewState property and refer to it from there.
If this is the currently executing page, use (Page)HttpContext.Current.CurrentHandler .
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
i am using a combobox and a textbox control. text box behaviour depends upon selected value of combobox. These properties of combo box are assingned.
AutoComplete = true;
AutoCompleteMode = SuggestAppend;
AutoCompleteSource = CustomSource
AutoDropDown = true;
Further more .net 2.0 is under usage with visual Studios 2005.
in combobox_TextChanged() event i have assigned some value to textbox control. now i want that when user is typing over the combo box then as he types first letter the TextChanged() event is triggered and my textbox values changes accordingly. i want to control it some how so that when user ends typing only then my textbox values are changed. I tried to control it through combobox.selectionStart and combobox.selectionLength properties but thay always give 0 values. So how should achieve my goal??
Furthermore when user start typing over combobox and in case selection changes then no key event is trigered (i.e keyPress(), keyUp() or keyDown() events)but it selection doesn't changes only then keyUP() event is trigered. Moreover event of combobox_SelectionChangeCommitted()is also tested and it is not triggered when user types on combobox.
Any suggestions?
May God help u solv ur problems as well,thx in advance!!
|
|
|
|
|
how to campare two images in C#?
How to write these changes(diffrence) in another file?
|
|
|
|
|
sushilhupare wrote: how to campare two images in C#?
How to write these changes(diffrence) in another file?
How to search Google[^]?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hello All,
I'm trying to develop a solution that will import data from a text delimited file into an Access table. Because the text file is created daily with a different file name, I just can't link the file directly.
I've loading successful loading the text data into a dataset but this is where I get lost. I sure would appreciate if someone could point me the right direction.
da1.Fill(dsText);<br />
<br />
da2.Fill(dsAccess);<br />
<br />
da2.Update(dsText); //Does not work for me
supercharged
VS2005
|
|
|
|
|
I need to use some field "ID" a couple of times in loop, say for example 4 times in a loop, which one of these code would be faster ?
<br />
foreach(XmlNode XMLNODE in XML_menu.SelectSingleNode("menu").ChildNodes){<br />
Console.WriteLine( XMLNODE.SelectSingleNode("@id").InnerText );<br />
Console.WriteLine( XMLNODE.SelectSingleNode("@id").InnerText );<br />
Console.WriteLine( XMLNODE.SelectSingleNode("@id").InnerText );<br />
Console.WriteLine( XMLNODE.SelectSingleNode("@id").InnerText );<br />
}<br />
or
<br />
foreach(XmlNode XMLNODE in XML_menu.SelectSingleNode("menu").ChildNodes){<br />
string ID = XMLNODE.SelectSingleNode("@id").InnerText;<br />
Console.WriteLine( ID );<br />
Console.WriteLine( ID );<br />
Console.WriteLine( ID );<br />
Console.WriteLine( ID );<br />
} <br />
What I mean is, is it faster to use "XMLNODE.SelectSingleNode" many times or should I first get its value into some string and then use that string many times?
|
|
|
|
|
Option 2 is more readable. The JIT compiler may be able to optimise option 1 to make only one call, and turn it into option 2 - but why make it hard for yourself?
|
|
|
|
|
I'm leaning toward option 2 as well... although, I'm a bit confused regarding "but why make it hard for yourself?", do you mean that I should go with the first option after all?
Thanks
|
|
|
|
|
I mean that writing and maintaining three copies of those function calls is making it hard for you, and making the code harder to read.
In general you should write readable and maintainable code. Let the compiler worry about how to optimize it.
|
|
|
|