C# (pronounced “See Sharp”) is a multi-purpose computer programming language suitable for a wide variety of development needs.
C# combines the power and flexibility of C++ with the simplicity of Visual Basic. It encompasses strong typing, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines with support for the concepts of encapsulation, inheritance, and polymorphism. It incorporates many elements of the expression and statement syntax of C, and has a more refined object-oriented programming syntax than C++.
C# is one of the more popular programming languages, but is not as widely used as say C, Java, C++ or PHP.
We have published a series covering the best open source programming books for other popular languages. Read them here.
By Rob Miles (216 pages)
The C# Book is a book that teaches you how to program using C#. It’s the basis of the first year programming course at the Department of Computer Science in the University of Hull.
- Computers and Programs – find out what a computer is and get an understanding of the way that a computer program tells the computer what to do. Discover what you should do when starting to write a program. The chapter finishes with a look at programming in general and the C# language in particular
- Simple Data Processing – create a genuinely useful program. Start by creating a very simple solution and investigate the C# statements that perform basic data processing. The author then uses additional features of the C# language to improve the quality of the solution
- Creating Programs – build on our programming abilities to make programs that are broken down into manageable chunks and find out how a program can store and manipulate large amounts of data using arrays
- Creating Solutions – a case study which will allow you to see the features of C# in a strong context
- Advanced Programming – looks at the ArrayList class, the List class, the Dictionary class, storing business objects, saving an account, loading an account, multiple accounts, handling different kinds of accounts, business objects and editing, threads and threading, structured error handling, program organisation, a graphical user interface including the XAML markup language, extensible markup languages, XML schema, and debugging
- Glossary of Terms
The author’s website indicates the book is released under an open-source license, although I’ve yet to receive confirmation.
By Svetlin Nakov, Veselin Kolev & Co (1122 pages)
This book is designed for beginners. It teaches the reader to think like a programmer and the C# language is just a tool that can be replaced by any other modern programming languages, such as Java, C++, PHP or Python. This is a book on programming, not a book on C#.
The book was originally written in the Bulgarian language by a large team of volunteer software engineers and subsequently translated into English.
The book is distributed freely.
By Wikibooks.org (175 pages)
This book provides a through treatment of the C# language. It covers the language basics, classes, advanced concepts, the .NET framework, and keywords.
The book is published under the Creative Commons Attribution-ShareAlike 3.0 Unported license.
By Charles Petzold (267 pages)
.NET Book Zero – What the C or C++ Programmer Needs to Know About C# and the .NET Framework is a book that provides an introduction to C# and the Microsoft .NET Framework for programmers who have experience with C or C++.
- Why .NET?
- Runtimes and SDKs
- Edit, Compile, Run, Disassemble – discusses the structure and contents of simple example programs
- Strings and the Console – a string is an object of type String whose value is text
- Primitive Data Types – takes a more methodical approach to data types of string, char, int, double and the other primitive data types supported by C# and the CLR
- Operators and Expressions – operator precedence and associativity, primary operators, unary operators, multiplicative and arithmetic operators, shift operators, relational operators, equality operators, logical operators and conditional operators, and assignment operators
- Selection and Iteration – discusses statements built around the if, else, switch, case, default, do, while, for, foreach, in, break, continue, and goto keywords
- The Stack and the Heap – keep memory management and garbage collection in mind in order to optimize the performance of applications
- Arrays – ordered collections of objects of the same type
- Methods and Fields
- Exception Handling – examines C# support for structured exception handling
- Classes, Structures, and Objects
- Instance Methods – when a method declaration does not include a static modifier, the method is said to be an instance method
- Constructors – enable the programmer to set default values, limit instantiation, and write code that is flexible and easy to read
- Concepts of Equality – explore in more depth the differences between classes (reference types) and structures (value types)
- Fields and Properties – classes and structures have several types of members, most notably fields, methods, constructors, and properties
- Inheritance – one of the primary features of object-oriented programming. Inheritance provides a structured way to reuse code that has already been written, but inheritance also provides a way to alter or enhance the code in ways that make it more useful or convenient
- Operator Overloading – permits user-defined operator implementations to be specified for operations where one or both of the operands are of a user-defined class or struct type
- Interfaces – an interface contains definitions for a group of related functionalities that a class or a struct can implement
- Interoperability – enables you to preserve and take advantage of existing investments in unmanaged code
- Dates and Times – a particular moment in time is represented by an object of type DateTime, a structure defined in the System namespace
- Events and Delegates
- Files and Streams
- String Theory
- Generics – a new feature in version 2.0 of the C# language and the common language runtime (CLR). Generics introduce to the .NET Framework the concept of type parameters, which make it possible to design classes and methods that defer the specification of one or more types until the class or method is declared and instantiated by client code
- Nullable Types – instances of the System.Nullable struct
This book is freely distributable.
Here are good free-to-download programming books which are not released under an open source license.
Creating Mobile Apps with Xamarin.Forms Book First Edition – covers Xamarin.Forms 2.x including Animation, MVVM, triggers, behaviors, custom layouts, custom renderers, and much more.
The Daily Design Pattern – teaches 22 software design pattersn in 22 days.
Dissecting a C# Application – Inside SharpDevelop – shows you the process, thinking and code behind the open-source .NET IDE SharpDevelop that went on to branch into MonoDevelop.
Threading in C#
C# 1: Introduction to programming and the C# language – aimed at anyone who wants to deal with programming and the .NET platform.
Object Oriented Programming using C# – aims to instill the reader with an understanding of the Object Oriented approach to programming and aims to develop some practical skills along the way.
Code Contracts Succinctly
Data Capture and Extraction with C# Succinctly
How to Design Classes
Data Structures and Algorithms with Object-Oriented Design Patterns in C#