|
In data Types , i would like to know what is the difference between refrence type and value type ,which is better in using and why ?
thanks ,
Mona
LA ELAH ELA ALLAH MOHAMED RASOL ALLAH
|
|
|
|
|
The almighty, magical google[^] returned this.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
All hail google.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Actually, there's no point in worrying about this, because you don't really have a choice, most of the time. But, I assume google told you that already.
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 )
|
|
|
|
|
It isn't a case of one being better than the other but of the situation you want to use them in.
In the vast majority of cases you'll go with a reference type. Very rarely you might need to create a value type.
Value types are copied each time you pass them around.
Reference types don't get copied, a reference is passed instead.
|
|
|
|
|
Ref Type: (a) is store data in heap memory And Accessing Through Refference.
(b) Efficent And Fast Accessing Method.
(c) Object type,Delegate,Interface,pointer is example that.
value type: (a) is store data in stack memory And Accessing through ordinary variable.
(b) Scope in Single block And another place duplicate complexity.
(c) int,float,double,char etc.
Beshak MOHAMED RASOL ALLAH
ali
|
|
|
|
|
So I am able to successfully enumerate the processes on a machine using the remote machine's name on the network such as:
Process[] myProcesses = Process.GetProcesses("Machine_Name_Here");
However, I'd like to also use myProcesses[0].Kill() for example to kill the process and then after use something like Process.Start("blah") to start it again.
The problem I am running into is that Process.Kill is not supported on remote machines. Additionally, I am not sure if I am able to launch the process through Process.Start either.
Is there anything I can do for this desired functionality?
|
|
|
|
|
InvalidTypecast wrote: The problem I am running into is that Process.Kill is not supported on remote machines. Additionally, I am not sure if I am able to launch the process through Process.Start either.
Neither is starting a remote process, for the obvious security implications.
You can start a NON-INTERACTIVE process remotely using the WMI Win32_Process class. But, again, the user will NOT see any indication that the process is running. It will not be allowed to put up ANY user interface at all.
|
|
|
|
|
Yes, these are just command line applications with no interactivity that I need to restart essentially. Do you know of an article that provides a noobie example on using WMI for this?
|
|
|
|
|
|
Not specifically for the Win32_Process class, but if you Google "C# WMI invoke method", you'll get something like this[^]. You can find the docs on the Win32_Process class here[^]. You're looking for the Create and Terminate methods.
|
|
|
|
|
Hello All,
Greetings!
My task is to retrieve the Date Taken field of images in a folder. Here is the code I have used
//For each file in the folder
void Srch_DT(FileInfo f, string condition,string value)
{
Image img = null;
PropertyItem pi = null;
try
{
img = Image.FromFile(f.DirectoryName + @"\" + f.Name);
pi = img.GetPropertyItem(36867);//Retrieve DateTaken
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
//Something else
}
As I see, if the number of images in the folder is large, I encounter this exception:
" A generic error occurred in GDI+."
What should be done to take care of this error?
Appreciate any help!
Thanks
D
|
|
|
|
|
Hi,
you should call img.Dispose() as soon as you no longer need the image,
so its unmanaged resources don't get lost.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi,
Thanks for that!
However I see the error even I after I use the img.Dispose().
Also it displays Not responding in the title. I am running this on Vista Home Basic.
D
-- modified at 15:01 Monday 22nd October, 2007
|
|
|
|
|
OK,
the problem is GDI+ has only a single error message, the one you are getting;
the next most probable cause is a bad image file, so make sure you see the filename
that is current when the exception occurs (best is to show Exception.ToString, not
just Exception.Message).
Then try if you can open just that one file, my best guess is you won't succeed;
delete (move away) that one file, and try again.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Bingo! Yes there were few corrupted images. It would be ok to by-pass these images.
However one last question..
After the application starts running. it shows Not responding in the title. How could I deal with this? Will this be an performance issue?
Thanks again for the solution!
D
|
|
|
|
|
Hi,
you're welcome.
I'm guessing you are doing all the image stuff on the main thread, which should be
free to keep the GUI alive. Two solutions, assuming your image stuff starts with the
click of a button:
1.
The official solution is to use a separate thread, which you would create and start
in the button click handler;
if you do, you would need Control.InvokeRequired and Control.Invoke() to access Controls
e.g. to show the exposure date (read up on these).
2.
A hack might do it: you can include Application.DoEvents() say once per image, provided
you make sure no recursion can occur, that is, you should disable that button for
as long as it is processing your images.
But 1. is definitely the better approach.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thanks Luc!
I have never worked with the thread stuff! Guess its time I get started on this.
Thanks again! U made my day!
D
|
|
|
|
|
Hi,
I am having some problems to use enqueue/dequeue classes.
private void btnSend_Click(object sender, System.EventArgs e)
{
for (int i = 0; i < chckListBox.Items.Count; i++)
{
if (chckListBox.CheckedIndices.Contains(i))
{
string tmpItem = chckListBox.Items[i].ToString();
//parse the string Names and Phone Numbers
string[] info = tmpItem.Split (',');
myQueue.Enqueue(info[0]);
while (myQueue.Count != 0)
{
myQueue.Dequeue();
}
}
}
}
I want to make use the values in dequeue in another mehtod, i want to send the each value of the queueue to a method, or want to sign it smthn else How can I do that?
|
|
|
|
|
Don't put "urgent" in the subject. However urgent you may feel that it is, it's never urgent enough to mention in the subject, or you wouldn't be posting in a forum instead of paying for assistance.
s3rro wrote: I want to make use the values in dequeue in another mehtod, i want to send the each value of the queueue to a method, or want to sign it smthn else How can I do that?
I can't really tell from that what it is that you want to do.
The Dequeue method returns the value. Once you get it, you can do whatever you like with the value. Example:
string value = myQueue.Dequeue();<br />
CallSomeMethod(value);
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Hmm, maybe he wants a priority queue - after all, that will allow him to dequeue the urgent items first
|
|
|
|
|
lmoelleb wrote: maybe he wants a priority queue
Right... a SortedQueue is something that's missing in the System.Collections.Generic namespace...
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
how i can understand ,which websites were opend
or
list of websites is open now
is this technology in winxp ?
thanks
micy c# program Developer
|
|
|
|
|
Hi
Any help would be greatly appreciated as I am very new to the .Net world. I was wondering if its possible to convert a string to an object - for example:
public void lala (string strReportName)
{
strReportName report = new strReportName();
report.SetDataSource(someDataSource);
//where the actual value contained within strReportName is
//a Crystal Report within my project
}
Thank you very much.
Linda
|
|
|
|
|
In the above example you are converting the string to a class name. This doesn't make any sense. However, you can create a Typeof Report from the crystal reports namesapce and then assign it using an if statement.
Report report = null;
if(String.Compare(reportName, "SomeReport") == 0)
report = new SomeReport();
To do it the other way would require reflection and is not a good solution in this case.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|