C# / C Sharp by API examples (example source code) Organized by topic






Microsoft.Win32 /

Registry 4RegistryKey 6
RegistryValueKind 2SystemEvents 1

System /

Activator 1AppDomain 17
AppDomainSetup 4ApplicationException 1
ArgumentException 1Array 26
Attribute 5AttributeTargets 3
AttributeUsage 1BitConverter 4
Boolean 2Char 13
Console 21ConsoleColor 1
ConsoleKey 3ConsoleKeyInfo 3
ConsoleModifiers 1Convert 7
DateTime 37DateTimeKind 1
DateTimeOffset 1DayOfWeek 1
Decimal 2DivideByZeroException 1
Double 3Enum 5
Environment 21EventArgs 1
EventHandler 1Exception 4
FormatException 1GC 5
Guid 2IADs 2
IAsyncResult 1ICloneable 1
IComparable 1ICustomFormatter 1
IDisposable 1IEquatable 1
IFormattable 1IndexOutOfRangeException 1
Int32 8IntPtr 1
InvalidCastException 1Math 9
Object 1Obsolete 1
Random 3SByte 2
Single 3StackOverflowException 1
String 36Timer 1
TimeSpan 13TimeZone 6
Type 26UInt16 4
UInt64 1Version 1

System.Collections /

ArrayList 28BitArray 6
DictionaryBase 1HashTable 9
IDictionaryEnumerator 2IEnumerable 5
IEnumerator 4Queue 3
SortedList 12Stack 3

System.Collections.Generic /

Collection 3Dictionary 2
IComparer 1IDictionary 3
IEqualityComparer 1KeyValuePair 2
LinkedList 4List 9
Queue 2SortedDictionary 2
Stack 3

System.Collections.Specialized /

NameValueCollection 1

System.ComponentModel /

CancelEventArgs 1Component 1
ISupportInitialize 1

System.Configuration /

AppSettingsReader 1

System.Data /

CommandBehavior 2CommandType 1
DataColumn 9DataRow 1
DataSet 9DataTable 6
DataTableCollection 1DataView 7
DataViewManager 2DataViewRowState 1
ParameterDirection 1

System.Data.Common /

DataTableMapping 1DbProviderFactories 1
DbProviderFactory 1

System.Data.Linq /

DataContext 1

System.Data.Odbc /

OdbcCommand 3OdbcConnection 1
OdbcDataAdapter 1OdbcException 1

System.Data.OleDb /

CommandType 1OleDbCommand 5
OleDbCommandBuilder 1OleDbConnection 9
OleDbDataAdapter 2OleDbDataReader 3
OleDbException 1OleDbParameter 1
OleDbSchemaGuid 1OleDbTransaction 2

System.Data.Sql /

SqlDataSourceEnumerator 1

System.Data.SqlClient /

SqlCommand 9SqlCommandBuilder 1
SqlConnection 13SqlConnectionStringBuilder 5
SqlDataAdapter 12SqlDataReader 13
SqlException 3SqlParameter 4
SqlTransaction 1

System.Diagnostics /

Conditional 1ConsoleTraceListener 1
Debug 4DefaultTraceListener 1
EventLog 9EventLogTraceListener 1
FileVersionInfo 10Process 18
ProcessModule 1ProcessPriorityClass 1
ProcessStartInfo 8ProcessThread 4
StackTrace 1Stopwatch 4
TextWriterTraceListener 1Trace 4
TraceSource 5TraceSwitch 5

System.DirectoryServices /

DirectoryEntries 3DirectoryEntry 11
DirectorySearcher 3PropertyCollection 1

System.Drawing /

Bitmap 11BMP 1
Brushes 3Color 10
Font 9FontFamily 5
FontStyle 3Graphics 48
GraphicsUnit 6Icon 1
Image 6ImageAnimator 2
Pen 8Pens 1
Point 4Rectangle 2
RectangleF 1Region 6
Size 1SmoothingMode 1
StringAlignment 3StringFormat 6
StringFormatFlags 3StringTrimming 6
SystemBrushes 1SystemColors 3
SystemFonts 1SystemPens 1
TextureBrush 2

System.Drawing.Drawing2D /

CustomLineCap 1DashStyle 1
FillMode 2GraphicsPath 10
HatchBrush 1HatchStyle 2
InterpolationMode 1LinearGradientBrush 2
LinearGradientMode 2LineCap 2
LineJoin 1Matrix 4
MatrixOrder 1PathGradientBrush 5
PenAlignment 2PixelOffsetMode 1
SmoothingMode 1

System.Drawing.Imaging /

ColorMatrix 1ImageAttributes 2
ImageCodecInfo 8Metafile 1
PixelFormat 4

System.Drawing.Printing /

PaperSize 1PrintDocument 6
PrinterSettings 4PrintPageEventArgs 1

System.Drawing.Text /

HotkeyPrefix 1InstalledFontCollection 1

System.EnterpriseServices /

ApplicationAccessControl 1

System.Globalization /

Calendar 4CultureAndRegionInfoBuilder 4
CultureInfo 13CultureTypes 1
DateTimeFormatInfo 6DaylightTime 3
JulianCalendar 1NumberFormat 1
NumberFormatInfo 5RegionInfo 1
StringInfo 2TimeZoneInfo 8

System.IO /

BinaryReader 9BinaryWriter 3
BufferedStream 5Directory 7
DirectoryInfo 12DriveInfo 8
File 10FileAccess 1
FileAttributes 7FileInfo 14
FileMode 2FileNotFoundException 1
FileShare 1FileStream 8
FileSystemWatcher 6MemoryStream 8
Path 3SearchOption 1
SeekOrigin 1Serializable 1
StreamReader 6StreamWriter 4
StringReader 2StringWriter 1
TextWriter 1UdpClient 1

System.IO.Compression /

GZipStream 1

System.IO.IsolatedStorage /

IsolatedStorageFile 3IsolatedStorageFileStream 1

System.IO.Ports /

Parity 1SerialPort 8

System.Linq /

Enumerable 15Queryable 42

System.Management /

ManagementObjectSearcher 1

System.Media /

SoundPlayer 1SystemSounds 1

System.Messaging /

Message 1MessageQueue 4
MessageQueueTransaction 1XmlMessageFormatter 1

System.Net /

CredentialCache 2Dns 6
FtpWebRequest 2FtpWebResponse 1
HttpListener 3HttpListenerContext 1
HttpWebRequest 5HttpWebResponse 4
IPAddress 7IPEndPoint 6
IPHostEntry 3NetworkCredential 1
Uri 7WebClient 11
WebHeaderCollection 2WebRequest 2

System.Net.Mail /

Attachment 1MailAddress 1
MailMessage 9SmtpClient 2
SmtpMail 1

System.Net.NetworkInformation /

IPStatus 1NetworkChange 2
NetworkInterface 7Ping 1
PingReply 2UnicastIPAddressInformation 1

System.Net.Sockets /

AddressFamily 1NetworkStream 4
ProtocolType 1Socket 15
SocketShutdown 1TcpClient 3
TcpListener 1UdpClient 5

System.Reflection /

Assembly 18AssemblyName 5
AssemblyTitleAttribute 1AssemblyVersionAttribute 1
BindingFlags 2ConstructorInfo 2
EventInfo 2ImageFileMachine 1
MemberInfo 4MethodInfo 2
Module 1ParameterInfo 1
PropertyInfo 3

System.Resources /

ResourceManager 3ResourceReader 1
ResourceSet 3ResourceWriter 4
ResXResourceReader 2ResXResourceWriter 3

System.Runtime /

MemoryFailPoint 1

System.Runtime.CompilerServices /

MethodImplOptions 1

System.Runtime.InteropServices /

Marshal 4

System.Runtime.Remoting /

ObjectHandle 1RemotingConfiguration 1

System.Runtime.Remoting.Channels /

ChannelServices 1

System.Runtime.Remoting.Channels.Http /

HttpChannel 1

System.Runtime.Remoting.Messaging /

AsyncResult 1IAsyncResult 2

System.Runtime.Serialization /

IDeserializationCallback 1ISerializable 1

System.Runtime.Serialization.Formatters.Binary /

BinaryFormatter 3

System.Runtime.Serialization.Formatters.Soap /

SoapFormatter 2

System.Security /

PermissionSet 2SecureString 1
SecurityManager 3

System.Security.AccessControl /

FileSecurity 2FileSystemAccessRule 1
FileSystemRights 1

System.Security.Cryptography /

CryptoStream 1DataProtectionScope 1
HashAlgorithm 2KeyedHashAlgorithm 2
ProtectedData 2RandomNumberGenerator 2
RSACryptoServiceProvider 2SHA1Managed 1
TripleDESCryptoServiceProvider 4

System.Security.Cryptography.X509Certificates /

X509Certificate 1

System.Security.Permissions /

FileIOPermission 1FileIOPermissionAccess 4
FileIOPermissionAttribute 1IsolatedStorageFilePermission 1
PrincipalPermission 2PrincipalPermissionAttribute 1
PrincipalPolicy 1ReflectionPermission 1
RegistryPermission 1SecurityAction 5
SocketPermission 1UIPermission 1

System.Security.Policy /

Evidence 2PolicyStatement 1
UnionCodeGroup 1

System.Security.Principal /

GenericIdentity 1IPrincipal 1
WindowsBuiltInRole 1WindowsIdentity 9
WindowsPrincipal 2

System.ServiceProcess /

ServiceBase 3ServiceController 4

System.Text /

ASCIIEncoding 1Decoder 1
Encoding 6StringBuilder 10

System.Text.RegularExpressions /

GroupCollection 2Match 3
Regex 7RegexCompilationInfo 1
RegexOptions 2

System.Threading /

AutoResetEvent 1Context 2
Interlocked 5ManualResetEvent 1
Monitor 4Mutex 2
ParameterizedThreadStart 1ReaderWriterLock 5
Semaphore 1Thread 19
ThreadPool 3ThreadPriority 1
ThreadStart 1TimerCallback 1
WaitHandle 1

System.Timers /

Timer 5

System.Web.Security /

FormsAuthentication 1

System.Web.Services /

WebMethod 1WebService 1

System.Windows.Controls /

ToolBar 6

System.Windows.Forms /

AnchorStyles 3Application 10
BorderStyle 1Button 17
CheckBox 6CheckedListBox 14
Clipboard 2ColorDialog 8
ComboBox 10ComboBoxStyle 2
ContextMenu 2Control 5
ControlStyles 2Cursor 1
Cursors 3DataFormats 1
DataGrid 2DataGridTableStyle 2
DataGridView 3DateTimePicker 6
DialogResult 1DockStyle 6
DomainUpDown 11DragEventArgs 2
ErrorProvider 2FlowLayoutPanel 1
FontDialog 7Form 75
FormBorderStyle 2FormStartPosition 1
FormWindowState 1GroupBox 2
HelpProvider 3HScrollBar 4
ImageList 5IMessageFilter 1
InputLanguage 2KeyEventArgs 5
KeyPressEventArgs 1Keys 3
Label 16LinkLabel 9
ListBox 21ListView 10
ListViewItem 1MainMenu 2
MaskedTextBox 4MdiLayout 3
MeasureItemEventArgs 1MenuItem 13
MessageBox 3MessageBoxButtons 2
MessageBoxIcon 1MonthCalendar 7
MouseButtons 1MouseEventArgs 2
NativeWindow 1NotifyIcon 3
NumericUpDown 12OpenFileDialog 11
PageSetupDialog 2PaintEventArgs 1
PaintEventHandler 1Panel 8
PictureBox 12PictureBoxSizeMode 1
PrintDialog 2PrinterSelectionDialog 1
PrintPreviewDialog 2ProgressBar 2
RadioButton 5RichTextBox 5
SaveFileDialog 4ScrollEventType 3
Shortcut 1SplitContainer 1
Splitter 2StatusBar 5
StatusBarPanel 4StatusStrip 1
SystemInformation 22TabControl 6
TableLayoutPanel 6TabPage 1
TextBox 28ToolBarButton 2
ToolStripMenuItem 1ToolStripProgressBar 2
ToolTip 1TrackBar 9
TreeNode 3TreeView 9
UserControl 1VScrollBar 4
WebBrowser 7WebBrowserProgressChangedEventArgs 2

System.Xml /

XmlDataDocument 1XmlDocument 9
XmlElement 2XmlImplementation 1
XmlNode 1XmlNodeType 3
XmlReader 5XmlReaderSettings 2
XmlTextReader 5XmlTextWriter 7
XmlWriter 3

System.Xml.Linq /

SaveOptions 1XAttribute 3
XCData 1XComment 1
XDeclaration 1XDocument 5
XDocumentType 1XElement 25
XNamespace 1XNode 3
XProcessingInstruction 1XStreamingElement 1
XText 1

System.Xml.Schema /

XmlSchema 2XmlSchemaSet 1
XmlValidatingReader 1

System.Xml.Serialization /

XmlArray 1XmlArrayItem 1
XmlAttributeAttribute 2XmlElement 1
XmlElementAttribute 1XmlRootAttribute 1
XmlSerializer 3

System.Xml.XPath /

IXPathNavigable 1XPathDocument 2
XPathNavigator 3XPathNodeIterator 3
XPathNodeType 1

System.Xml.Xsl /

XslCompiledTransform 2XsltArgumentList 1
XslTransform 2