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





Microsoft.Win32 /

Registry 4RegistryKey 6RegistryValueKind 2SystemEvents 1

System /

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

System.Collections /

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

System.Collections.Generic /

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

System.Collections.Specialized /

NameValueCollection 1

System.ComponentModel /

CancelEventArgs 1Component 1ISupportInitialize 1

System.Configuration /

AppSettingsReader 1

System.Data /

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

System.Data.Common /

DataTableMapping 1DbProviderFactories 1DbProviderFactory 1

System.Data.Linq /

DataContext 1

System.Data.Odbc /

OdbcCommand 3OdbcConnection 1OdbcDataAdapter 1OdbcException 1

System.Data.OleDb /

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

System.Data.Sql /

SqlDataSourceEnumerator 1

System.Data.SqlClient /

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

System.Diagnostics /

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

System.DirectoryServices /

DirectoryEntries 3DirectoryEntry 11DirectorySearcher 3PropertyCollection 1

System.Drawing /

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

System.Drawing.Drawing2D /

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

System.Drawing.Imaging /

ColorMatrix 1ImageAttributes 2ImageCodecInfo 8Metafile 1
PixelFormat 4

System.Drawing.Printing /

PaperSize 1PrintDocument 6PrinterSettings 4PrintPageEventArgs 1

System.Drawing.Text /

HotkeyPrefix 1InstalledFontCollection 1

System.EnterpriseServices /

ApplicationAccessControl 1

System.Globalization /

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

System.IO /

BinaryReader 9BinaryWriter 3BufferedStream 5Directory 7
DirectoryInfo 12DriveInfo 8File 10FileAccess 1
FileAttributes 7FileInfo 14FileMode 2FileNotFoundException 1
FileShare 1FileStream 8FileSystemWatcher 6MemoryStream 8
Path 3SearchOption 1SeekOrigin 1Serializable 1
StreamReader 6StreamWriter 4StringReader 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 4MessageQueueTransaction 1XmlMessageFormatter 1

System.Net /

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

System.Net.Mail /

Attachment 1MailAddress 1MailMessage 9SmtpClient 2
SmtpMail 1

System.Net.NetworkInformation /

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

System.Net.Sockets /

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

System.Reflection /

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

System.Resources /

ResourceManager 3ResourceReader 1ResourceSet 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 1SecurityManager 3

System.Security.AccessControl /

FileSecurity 2FileSystemAccessRule 1FileSystemRights 1

System.Security.Cryptography /

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

System.Security.Cryptography.X509Certificates /

X509Certificate 1

System.Security.Permissions /

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

System.Security.Policy /

Evidence 2PolicyStatement 1UnionCodeGroup 1

System.Security.Principal /

GenericIdentity 1IPrincipal 1WindowsBuiltInRole 1WindowsIdentity 9
WindowsPrincipal 2

System.ServiceProcess /

ServiceBase 3ServiceController 4

System.Text /

ASCIIEncoding 1Decoder 1Encoding 6StringBuilder 10

System.Text.RegularExpressions /

GroupCollection 2Match 3Regex 7RegexCompilationInfo 1
RegexOptions 2

System.Threading /

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

System.Xml /

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

System.Xml.Linq /

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

System.Xml.Schema /

XmlSchema 2XmlSchemaSet 1XmlValidatingReader 1

System.Xml.Serialization /

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

System.Xml.XPath /

IXPathNavigable 1XPathDocument 2XPathNavigator 3XPathNodeIterator 3
XPathNodeType 1

System.Xml.Xsl /

XslCompiledTransform 2XsltArgumentList 1XslTransform 2