|
|
how can show the drives with memory and to install an application in particular drive
naveen
|
|
|
|
|
You may check free space of any drive by using an object of System.IO.DriveInfo class.
Therefore following line will provide you free disk space provided on c drive-
System.IO.DriveInfo dr= new System.IO.DriveInfo("C:\\");
long FreeSpace= dr.AvailableFreeSpace;
In case if you need to know about all logical drives available on a system, you may use Environment.GetLogicalDrives() method. This will return you a string array containing all logical drives available on a system.
Such as –
string[] drives = Environment.GetLogicalDrives();
I hope this helps.
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Hello,
I need to change a string array to string object. Can somebody please tell me how to do that?
Thank you.
|
|
|
|
|
What are you trying to accomplish? Everything in .NET is already implicitly an object. An array is, by definition, a collection of like values. You can't convert a string array to a string object, but you can access individual elements inside of the array.
|
|
|
|
|
//String array
string[] stringArray={"a","b","c"};
//Get a string value at a certain position
string first = stringArray.GetValue(0).ToString();
string second = stringArray.GetValue(1).ToString();
string third = stringArray.GetValue(2).ToString();
//enumerate through the array and get objects
foreach(string s in stringArray)
{
Console.WriteLine(s);
}
Hope this helps.
|
|
|
|
|
string[] myStringArray = new string[]{"foo","bar","due"};<br />
string myStringObject = String.Join(",",myStringArray);<br />
|
|
|
|
|
You can to that in few ways
string[] strArray={"one","two","three"};
// Using foreach
string result = String.Empty;
foreach(string str in strArray)
{
result += str + "\n";
}
//Using ArrayList
StringBuilder sb = new StringBuilder();
foreach(string str in strArray)
{
sb.AppendLine(str);
}
// then for example
Console.Write(sb.ToString());
DEV36 Dominik Goss
|
|
|
|
|
Why would you do either with a perfectly usable String.Join method?
Both your examples are just equivalent to String.Join("\n",strArray)
|
|
|
|
|
Yes, you're right. You code is much more Object-oriented , and shorter
DEV36 Dominik Goss
|
|
|
|
|
hi .
how i can monitor internet traffic ?
(how i can give list of opend websites)
|
|
|
|
|
I don't think you can see what webistes are currently open, you could see what page was last accessed (well, which ip anyway)
But you wouldn't know if a person had closed their browser or anything.
You might be able to somehow get which pages are open from the browser itself, but, i don't know. It doesn't seem likely.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
|
thanks for help.
Judah Himango
|
|
|
|
|
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.
|
|
|
|