Is There Anybody Out There? Which Ports on Your Computers Are Listening?
Determine which ports on a computer have an application listening.
Determine which ports on a computer have an application listening.
Programmatically make sure all your computer systems are at least powered on and available on the network. Easily add this functionality to your applications!
Discover how to use constant fields without having to hard code the values into the class.
Reduce your boolean logic to keep you program readable.
Simplify finding the entry you need from an event log.
Monitor the health of the processes running on your system.
Create a List<T> that cannot be modified.
Discover how to use nullable types when retrieving data from your database.
Convert a string to an array of bytes and back again.
Is it a number, a letter, punctuation? Use this extension method to determine the type of a character variable.
Use LINQ's from clause to easily traverse the relationships in your database.
Provide your own comparison algorithm when sorting by implementing the IComparer interface.
Create a class to add Error, Warning, and Information entries in the Windows event log.
Allow a single call to your method to return multiple objects using the ref keyword with parameters.
Allow your classes to easily be sorted they way you would like by implementing the IComparable interface.
Use @-quoted strings to avoid escape characters in your string literals.
Use LINQ to Objects to easily sort and reshape your data.
LINQ can be used for much more than just accessing data stored in your database. Learn how you can use the from clause with other types of data.
Do you need to know when a file or directory has been updated? The FileSystemWatcher class gives you a very easy means to monitor the file system.
What do you do when you need to read in an entire file and process it as a string? Here is a simple solution.
The singleton pattern can be used in a wide variety of situations. This tip will show you how to create a thread-safe version of a singleton.
Learn how to take a string and convert it into an enumeration value.
Most applications developers build have lists or dropdowns that need to be filled with values for the user to select. This tip will show you how to use an enumeration to populate your lists.
Extension methods allow you to create utility functions and have them appear to be part or your classes or the built-in classes. You'll learn by making a method from an earlier tip available as an extension method.
Discover how to display the public information for an assembly. This will allow you to get a complete view of the assemblies you are using or creating.
Learn how to display all of the fields and properties of any object. By using a little reflection, you can expose the internals of your objects.
Have you ever not known how many parameters a method would need to accept? The C# params keyword lets you pass a variable number of arguments to a method.
Have you ever needed to execute a system command from your application? You can accomplish this easily with C#.
Take a look at a couple of the language enhancements in C# 3 (VS2008) that can speed up your development and make your code cleaner: automatic properties and initializers.
Converting strings of digits into numeric data types may not always yield the result you expect. Take a look at three ways to convert a string of digits to an integer and learn what you need to watch out for with each method.
Use custom exceptions to add information that will be more meaningful to your users when exceptions occur. And, you still can maintain all the information from the original exception.
Use some of the language's lesser known features for safe type casting and comparison.
Handling exceptions can sometimes be a little tricky. If you are not careful, your code may act on the wrong information. Learn how to bubble up exceptions while keeping the original exception information intact.
Here is encapsulation, one of the very basic tenets of object-oriented programming. Using properties instead of public variables helps insulate the users of your class from change, provides you more flexibility, and will ease maintenance of your class.
Are you tired of hard-coding function names in trace messages? Have you ever used cut and paste to copy a trace statement and forgot to change the function name? There'll be no more wild goose chases because of bad function names when you determine the function name dynamically.
Be a good resource citizen by implementing IDisposable. You will be able to ensure that your objects have the opportunity to release all of their managed and unmanaged resources.
Take control of the lifetime of your objects. Release your object's resources on your schedule, not when the CLR determines they are no longer needed.
Stop unwanted changes to your properties! Discover how to you can stop worrying about accidentally changing values, while still allowing multiple views into your classes!
Stop writing more code than needed. You can streamline your code if you use interfaces. You will be able to write simpler, more flexible, and more maintainable applications when you apply interfaces.