|
public someClass
{
public double methodOne(int arg1, List<double> arg2)
{
float number = Math.Sqrt(arg1)
double answer;
arg2.ForEach(delegate{double itemVal)
{
answer += (arg1 < 0) ? extClass.Meth1(this, itemVal, arg1) : extClass.Meth2(this. itemVal, arg1);
}
}
}
public class extClass
{
public double Meth1(someClass mySomeClass, double value, int order)
{
blah blah
double var = mySomeClass.MethodOne(myInt, myListDoubles)
}
}
Surely there is some sort of recursion happening here. I call it indirect recursion - as a result of MethodOne being indirectly recursed then so too is the Action delegate within MethodOne. If I wanted to prevent this I would have MethodOne examine the stack to determine if it, itself, has a prior entry and to react accordingly (it might raise an Exception or simply return zero). If I did not detect recursion and do something about it at the top of the method then I say that MethodOne, including the anon methods therein, are in a state of recursion.
|
|
|
|
|
Yes, there is indirect recursion, and there is an anonymous method, but they are independent of each other. The anonymous method is not an integral part of the recursion. If the Meth1 method would have called the anonymous method, it would have been.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
point taken - how about consequential recursion;P
the stack interrogation method works fine, and I've generalised it into a static method, so the code in the anon method looks reasonable ie within a directory related anon method it would look something like utils.RecurseMe(directory, includeReparsePoints) - RecurseMe's currently only handles void methods, when I need it I'll do a generic version to handle return values.
today public static void RecurseMe(params object[] methodParams);
tomorrow public static void RecurseMe<retType>(params object[] methodParams) where retType:class;
|
|
|
|
|
To define recursion, we must first define recursion!!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
pjd, did you figure out how to do this? It looks like you can do it by first assigning it to null:
Function f = null;
f = delegate() { f(); }
|
|
|
|
|
Judah,
thanks I've filed that away for future reference - can't recall the context in which I wanted to do it now - probably a predicate method.
|
|
|
|
|
This sounds like a C++ question. Are you sure you're in the right forum?
|
|
|
|
|
I am using a commercial grid to display my data. I don't have any problem to display the whole table to the grid. For instance, the following code displays a whole table to the grid.
<br />
grid1.SetDataBinding(table1BindingSource);<br />
Now, I only want to display the FirstName and the LastName
I have the following in my form
table1BindingSource and db1DataSet
From db1DataSet, I can see the following by intellicense; my table names Tabl1
from intellicense I can see
Table1.FirstNameColumn and Table1.LastNameColumn;
My question, how can I use table1BindingSource and db1DataSet to display only the firstname and the lastname rather than the whole table?
|
|
|
|
|
You could use the Query Builder. Assuming you are using C# Express Edition, this "in-built" help page from the C# help file that installs with the C# express edition will show you how. There are also related help pages you might like to read! There are other ways to achieve the desired result but for a novice, this might be the easiest way.
ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/dv_vdt01/html/815a30ce-6fb1-4611-bf43-bedd2020c443.htm
Although you are wanting to program in C#, the question is about database. Try posting database questions in the correct forum.
modified 1-Aug-19 21:02pm.
|
|
|
|
|
Try this link.
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hey guys
i have a c# project and ive added a project installer...
is there any way i can install some fonts to in the windows font directory as the application gets installed?
many thanks
Will
|
|
|
|
|
Checkout the help of the Visual Studios...
It is all in there ...
Don't you also love the code?
|
|
|
|
|
ive had a dig around and cant much :S
can u point me in the right direction?
|
|
|
|
|
When you have created a new setup project in vs2005, you go to the 'File System' right click on 'File System on Target Machine', 'Add Special Folder', 'Fonts Folder'.
And then you just add in the Fonts folder the right files...
Just of topic... I have helped you could you help me? I want to finish my work (General Discussion - Cards?).
Don't you also love the code?
|
|
|
|
|
thanks dude! spot on!!
|
|
|
|
|
hi every one,
well I have this little problem here. I'm getting a nullreferenceException when I try to access the value of a DataGridViewComboBox column. I have correctly bounded the column and its also showing the values of that table too. The name of the column is "AttendanceComboBoxColumn". now I just wanna know how to get the value selected in this comboBox.
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
//MessageBox.Show("att: " + dataGridView1["AttendanceComboBoxColumn", i].Value.ToString() + "\n empid: " + dataGridView1["empIDDataGridViewTextBoxColumn", i].Value.ToString()+"\nDate: "+selected_date.ToString());
//MessageBox.Show("att: " + dataGridView1["AttendanceComboBoxColumn", i].Value.ToString() + "\n empid: " + dataGridView1["empIDDataGridViewTextBoxColumn", i].Value.ToString());
//MessageBox.Show("att: " + dataGridView1["AttendanceComboBoxColumn", i].Value.ToString() );// null ref
//MessageBox.Show("att: " + dataGridView1["empIDDataGridViewTextBoxColumn", i].Value.ToString()); // ok
//sqlUpdateCommandAttendance.Parameters["@AttendanceID"].Value = Convert.ToDecimal(dataGridView1["AttendanceComboBoxColumn", i].Value);
int c = AttendanceComboBoxColumn.DisplayIndex;
MessageBox.Show(dataGridView1[c, i].Value.ToString());
sqlUpdateCommandAttendance.Parameters["@AttendanceID"].Value = Convert.ToDecimal(dataGridView1[c,i].Value);
sqlUpdateCommandAttendance.Parameters["@original_empid"].Value = Convert.ToDecimal(dataGridView1["empIDDataGridViewTextBoxColumn", i].Value);
sqlUpdateCommandAttendance.Parameters["@original_attendDate"].Value = selected_date;
count+=sqlUpdateCommandAttendance.ExecuteNonQuery();
}
thanks in advance
Rocky
|
|
|
|
|
how can I call a *.exe file from whithin the c# code
Dad
|
|
|
|
|
here u go.
Process p = new Process();
p.StartInfo=new ProcessStartInfo("C:\\CleanMyPCOnStartUp.exe");
p.Start();
|
|
|
|
|
if u want to invoke methods / load forms in a particular exe u can use reflection!
|
|
|
|
|
Is there a way to add lets say "Australia", "Canada", "US" to a combobox dropdown and also set a value such as '5','3','2'?
Visually we'll be able to see the country names...however the numbers above are associated with each country.
|
|
|
|
|
i don't think you can manually set a value to a comboBox item. You can however get the selectedIndex for that item that is chosen.
ex:
comboBox1.Items.Add("US");
comboBox1.Items.Add("CA");
string value = comboBox1.SelectedIndex.ToString();
int value = comboBox1.SelectedIndex;
So if US is selected it will store "0" in the variable "value". If CA is selected it would store "1" etc. Let me know if this helps you.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Hi,
instead of adding just strings you could add objects holding every info you need:
public struct CountryWithid {
public string Country;
public int Id;
public CountryWithid(string country, int id) {
this.Country = country;
this.Id = id;
}
public override string ToString() {
return this.Country;
}
}
comboBox.Items.Add(new CountryWithId("US", 8));
comboBox.Items.Add(new CountryWithId("Canada", 3));
int selectedid = ((CountryWithId)comboBox.SelectedItem).Id;
Robert
|
|
|
|
|
Extendind on Robert's answer, I have a generic ComboBoxItem class that contains four properties and a method:
int Id - ID of the item
Guid Guid - another ID in Guid form
string Text - text to display
object Tag - any object you would like to assign
string ToString() - simply returns the Text property
And I use that class to add objects to ComboBox es when I have your need.
|
|
|
|
|
how can i receive and send a call through TAPI. can i any one have idea how to use to TAPI and how to connect modem for these typr of application.
Thanks and best Regards.
Zahid kareem
|
|
|
|
|
Hi,
I'm new to C#.
What i have done so far is a simple windows application from which
users input data.
These data is then to be inserted in a pdf file.
Some of the words in this PDF file are distinct so when i search the file
and stumbles on one of this distinct word, i replace it with a user inputted
word.
Also i want to make a copy of the pdf file so i don't screw up the original.
Any suggestions or alternatively solutions?
No need to give full solutions, then i won't
learn anything
Thanks, Daniel from Sweden
|
|
|
|