|
Have VS produce XML documentation and read that.
|
|
|
|
|
Just in case my code is fully documented with XML comments.
Beside, with XML comment, I can't find reference of classes or methods that are using somewhere in source code.
|
|
|
|
|
Hello Everybody,
I want to know that How many Compilers are used in C#.
Thanks
If you can think then I Can.
|
|
|
|
|
Do you mean how many C# compilers exist?
there is one in each version of the .NET FrameWork for Windows, it is called csc.exe
I expect there are a few others that are popular, e.g. in the Mono environment.
And there must be a couple around in research and university environments.
or do you mean how many compilers (for whatever input language) have been created using C#?
that, I don't know at all. I see no major obstacle for writing a compiler in C#, although the majority will be in C++, mainly for historical reasons.
|
|
|
|
|
Actually i want to know that how many times a program code is compiling in C#.
If you can think then I Can.
|
|
|
|
|
every build you do happen once
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Are you referring to the two-stage C#->MSIL and MSIL->machine code compilation process?
|
|
|
|
|
Many examples explains thread safe access over a single control,like updating a text of a
button or label etc.,How to change properties of multiple controls of a Form in thread safe manner.
private Thread CheckStatusThread = null;
public delegate void CheckStatusDelegate(int Count);
public CheckStatusDelegate CheckStatusHandler;
public Form1()
{
InitializeComponent();
CheckStatusThread = new Thread(new ThreadStart(CheckStatusThreadFunc));
CheckStatusHandler = new CheckStatusDelegate(CheckPowerStatus);
}
private void Form1_Load(object sender, EventArgs e)
{
CheckStatusThread.Start();
}
public void CheckStatusThreadFunc()
{
int Cnt = 1;
while (true)
{
this.Invoke(CheckStatusHandler,new object []{Cnt});
Cnt++;
Thread.Sleep(500);
}
}
public void CheckPowerStatus(int Count)
{
int Cnt=Count;
StatusBarLabel1.Text = "Checking PowerStatus " + Cnt;
dataGridView1.Rows[2].Cells[4].Value = Cnt;
label1.Text = Convert.ToString("Cnt "+Cnt);
}
The CheckPowerStatus function change properties of 3 controls in Form1.
Do I need to use 3 delegates to update each control on 3 different functions.
Or the above code is thread safe?
|
|
|
|
|
All threading issues get referred to Luc - see his articles[^] here.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Interesting link.
|
|
|
|
|
you're not allowed to touch a Control from a random thread, so yes you need one or more Invoke calls. The proper way to handle simultaneous Control updates is by stuffing all the data you need in a little suitcase (i.e. a little class) and invoke once, let the delegate unpack the suitcase and do whatever needs to be done to the GUI. Assuming all GUI Controls got created on the main thread, all those Control.Invoke calls are equivalent anyhow, they all send the delegate to the main thread, no matter what they do to which Control.
This[^] article of mine explains the basics, you may know most of it already.
|
|
|
|
|
In article, you suggest to use Control and the property as generic parameter.
But Control is the base class.The common property is only Text for all controls.
But in case of specific properties of a control,how can use generic method.
Suppose DataGridView.Rows[2].Cells[3].Value-how can use Control?
Because Control.Rows does not exists.
So if I need to update or access 3 controls 2 properties,
then have to write 6 delegates and 6 functions to do the job?
|
|
|
|
|
Actually I already answered that; here is one way:
public void SetCount(int count) {
dataGridView1.Invoke(new MethodInvoker(delegate() {
StatusBarLabel1.Text = "Checking PowerStatus " + count;
dataGridView1.Rows[2].Cells[4].Value = count;
label1.Text = Convert.ToString("Cnt "+count);
}));
}
|
|
|
|
|
Thanks for your replies Luc Pattyn.
Here you only use dataGridView1.Invoke,
but update other controls also.Is that ok?
|
|
|
|
|
poda wrote: Is that ok?
Yes. I told you before:
all those Control.Invoke calls are equivalent anyhow, they all send the delegate to the main thread, no matter what they do to which Control.
And you're welcome.
|
|
|
|
|
Required reading, if you ask me.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Would you please kindly refer me some links.
|
|
|
|
|
I do not understand why this will not compile. I have used it in other programs but I must be missing something here.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace mfwmp
{
public partial class Form1 : Form, IMessageFilter
{
public Form1()
{
InitializeComponent();
Application.AddMessageFilter(this);
}
}
}
|
|
|
|
|
Well the PreFilterMessage() Method has been part of the interface since at least .Net 1.1.
It would be a pretty weird interface if it had no methods or properties.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Read the error message. You created a class that inherits from Form and IMessageFilter , but you never provided an implementation for IMessageFilter.PreFilterMessage(...) .
|
|
|
|
|
Thanks got it fixed with your help. Stupid me. I assumed the minimal code should have compiled.
|
|
|
|
|
Hi George,
electriac wrote: public partial class Form1 : Form, IMessageFilter
when you promise to implement some interface, you must do so. Hence:
- either drop the IMessageFilter in that line;
- or provide all its members; that would be bool PreFilterMessage(ref Message m) { ... }
Cheers,
Luc
|
|
|
|
|
Hi all,
I was learning yield operator. And made a function like this.
public IEnumerable<Guid> GetIds(int count, DateTime time)
{
Console.WriteLine("Start");
{
if (DateTime.Now > time)
yield break;
else
yield return Guid.NewGuid();
}
Console.WriteLine("End");
}
But End never get printed.Can anyone tell why? Because after break statement it should get out of the loop and print it.
|
|
|
|
|
(what loop?)
yield break does not break out of a loop, it "signals the end of the iterator", or as msdn also says:
"In a yield break statement, control is unconditionally returned to the caller of the iterator"
Source: http://msdn.microsoft.com/en-us/library/9k7k7cf0.aspx[^]
|
|
|
|
|
From the relevant MSDN page for break :
The break statement terminates the closest enclosing loop or switch statement in which it appears. Control is passed to the statement that follows the terminated statement, if any.
So break breaks out of loops and switch statements. I am guessing that in this case it breaks out of your method.
Same for yield :
Used in an iterator block to provide a value to the enumerator object or to signal the end of iteration.
Once again yield is meant to be used in an iteration. if is not strictly speaking an iteration, although I suspect that your else block would run.
The pages I looked at did not say what these statements do when not used in iterations.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|