Using PowerShell to Delete Files Not Written to in ‘X’ Days
If you have ever had any type of program or application that keeps logs or fouls up the \temp\ directory in your system you know the frustration that comes from wasted disk space with old, unused files. Luckily, you can create a very basic PowerShell script to check a given folder and delete files that are older than a set number of days.
Click Here To Continue Reading …
How-To: Create a Visual Studio 2010 Code Snippet
As you work through various projects in Visual Studio 2010 you will find yourself reusing a lot of code. In fact, you may find yourself reusing a lot of the same static code, or code that follows a basic pattern. Visual Studio 2010 lets you cut out a lot of this wasted time by employing code snippets. Code snippets can generate basic code patterns or layouts on the fly inside your project. Today I will walk you through creating a basic code snippet for generating a C# class with specific section stubs.
Click Here To Continue Reading …
Reboot Trick
Have you ever had the issue where Windows insists that there are pending install or uninstall operations even after a system reboot? This can often be caused by programs not cleaning up a specific key in the registry. So here is a quick fix you can use to correct this problem.
Click Here To Continue Reading …
Write to XML with C#
So we can read XML in a variety of ways (one example here, and another here). So can we write it in C#? Of course we can! So lets jump right into shall we?
Click Here To Continue Reading …
Solution Folders in Visual Studio 2010 Explained
If you are new to Visual Studio, you may not be familiar with how “Solution Folders” work. Visual Studio allows you to group together any number of sub-projects that your root solution may contain. However, what is strange about Solution Folders in Visual Studio is that they do not create the same logical structure on your disk. Solution Folders will not create a mirror on your hard drive. They just create a logical grouping inside your Visual Studio Project. They will not move files around, or create directories for your projects when you create Solution Folders and place your projects inside them. It is a good practice to have your logical project structure to have a one-to-one relationship with your physical directory structure, and the behavior of the Solution Folders do not follow this. But there is a way for Visual Studio to create the physical structure on the disk when adding projects to the solution.
Click Here To Continue Reading …
Using LINQ to Extract Information from XML in C#
Yesterday I talked about using C# to extract information from a simple XML file. Well today we can take it one step further. Instead of using the regular XML library and commands, we can use LINQ to build a query to extract the information we desire, and place it into our object list.
Click Here To Continue Reading …
Extracting Information From XML With C#
XML is a wonderful way to store information that needs to be read in by a machine or piece of software. It is simple to follow, and you can use it to store and transmit your custom data structures and information across an internet connection or in between bits of software on a local machine. C# has methods built in that can read and write XML files. So today I have put together a little program that will extract a few objects from an XML file in C# for you to see.
Click Here To Continue Reading …
Lambda Expressions and Delegates in C#
In a previous post I discussed chaining C# delegates together. In the source code example, I created a generic DelegateMath class to house a few basic math operations. This time we will replace those functions with simpler and shorter lambda expressions.
Click Here To Continue Reading …
Delegate Chain of Command
Another cool thing about delegates is the ability to chain them together. Say for example you have an object modification process, and you need a given object to be manipulated in a very specific order. Well you could use a delegate chain to accomplish that. For a simple example I have written up a C# delegate chain program that evaluates a mathematical expression following the order of operations by using a delegate chain.
Click Here To Continue Reading …
Quickly Print ANYTHING to a PDF!
Have you ever needed to send a file to a friend or a colleague only to find that they cannot open it? Or have you ever had to print a file on a public computer such as in a college library, then only to find that the computer does not have the program you need to read the file? With very specific software (AutoCAD for example) that only a handful of people use you might find it difficult to print your document from somewhere else. What if you could print the document to a universal format? Say like a Portable Document Format or better known as a PDF file? This article will show you how to quickly, and easily print ANYTHING you want to a PDF file!
Click Here To Continue Reading …
