Creating C# objects at run-time is easy. Just call the Activator.CreateInstance method.
For example, to create the same type of object as the current object using its default constructor:
Activator.CreateInstance( this.GetType() );
Creating C# objects at run-time is easy. Just call the Activator.CreateInstance method.
For example, to create the same type of object as the current object using its default constructor:
Activator.CreateInstance( this.GetType() );
Recently I posted a list of the Best C# Blogs. Today we recognize the best C# Web sites.
Following (in alphabetical order) are the best C# sites active on the Web today. Also included is the “About” section of the site (edited for space and clarity). Please comment if you can recommend other excellent C# web sites that didn’t make my list.
Sometimes you need to be able to convert between multiple data types. One solution is to create a “universal type converter,” which is an object that implicitly executes all of the desired type conversions.
This blog is usually a place for answers, but today I have a web service question that has stumped me and the experts I’ve consulted thus far. Here is my challenge:
When a client connects to a C# web service, how can it bind to a specific DLL in the web service “bin” folder?
Reflection is a handy mechanism in .NET that enables you to obtain class information, get and set properties, and invoke methods entirely at run-time. Reflection can also provide information about the object and method that called a particular method. This can be useful for debug and trace purposes.
Reading the contents of a web page is easy in C# with the System.Net.WebClient class:
What makes a C# blog good? Pretty much the same thing that makes any blog good, but with a focus on C#, of course. Good C# blogs have:
When constructing a C# Object, it’s important to understand the order in which the object’s fields and constructors are initialized:
Following are some simple but useful FREE tools for software developers. Each tool is freely distributable and includes the original C# source code so you can modify the tool to your needs. These tools are not supported. Enjoy!
Select a .NET KnownColor or other color, copy RGB and hex values to the clipboard.
Generate a new globally-unique ID and copy it to the clipboard.
Quickly convert between hex and decimal numbers.
Search/replace the path and working directory in a collection of shortcut (.lnk) files.
Console program that installs/removes tabs and custom controls and components in the Visual Studio .NET Toolbox.
Shows the form and client bounds of the active window.
C# 2.0 introduced the ?? or null coalescing operator. The ?? operator has two operands and can be used in an expression as follows:
x = y ?? z;