ADBRITE ads links
You are here: CodeIdol.com > C# > C# Cookbook, 2nd Edition > Toolbox
C# Cookbook, 2nd Edition
| Problem:
You want to be notified whenever the operating system or a user has initiated an action that requires your application to shut down or be inactive (user logoff, remote session disconnect, system shutdown, hibernate/restore, etc.). This noti...
|
|
| Problem:
You need to programmatically manipulate a service that your application interacts with.
Solution:
Use the System.ServiceProcess.ServiceController class to control the service. ServiceController allows you to interact with an existing ...
|
|
| Problem:
You want to know what current processes have a given assembly loaded.
Solution:
Use the GetProcessesAssemblyIsLoadedIn method that we've created for this purpose to return a list of processes that a given assembly is loaded in. GetPro...
|
|
| Problem:
You need a way to disconnect two components of your application (like a web service endpoint and processing logic) so that the first component has to worry about only formatting the instructions and the bulk of the processing occurs in the ...
|
|
| Problem:
You need the path to where the version of the .NET Framework you are running on is located.
Solution:
Use the GetruntimeDirectoryRuntimeDirectory method (implemented in System.Runtime.InteropServices.RuntimeEnvironment) to return the ...
|
|
| Problem:
You need to determine all of the versions of an assembly that are currently installed in the GAC.
Solution:
Use the PrintGACRegisteredVersions method (implemented here) to display all of the versions (both native and managed) of an as...
|
|
| Problem:
You need to know the full path to the Windows directory.
Solution:
Call the GetWinDir method created for your use here to return the Windows directory path in a string:
public static string GetWinDir()
{
string sysDir = En...
|
|
| Problem:
You want to capture output that is going to the standard output stream from within your C# program.
Solution:
Use the Console.SetOut method to capture and release the standard output stream. SetOut sets the standard output stream to w...
|
|
| Problem:
You want to run code isolated from the main part of your application.
Solution:
Create a separate appdomain to run the code using the appdomain.CreateDomain method. CreateDomain allows the application to control many aspects of the ap...
|
|
| Problem:
You want to know the current operating system and service pack.
Solution:
Use the GetOSAndServicePack method shown in Example 20-2 to get a string representing the current operating system and service pack. GetOSAndServicePack uses th...
|
|
You are here: CodeIdol.com > C# > C# Cookbook, 2nd Edition > Toolbox
|
|
Related tags
Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......
|
|