C# Programming
5/5
()
About this ebook
It covers virtually most of core features and some of the advanced features of C# Programming for dynamic website development including more than hands on examples tested through .NET. Most of code samples are presented in easy to use way through any simple text editor starting from notepad to rich editor like Microsoft Visual Studio.Net. Throughout the book most of the programming features are explained through syntax and examples to develop state-of-the-art Windows and Web applications using advanced concepts like Threading, GUI and other authentication features.
Read more from Jitendra Patel
Computer Programming In C Language Rating: 4 out of 5 stars4/5PHP & MySQL Practice It Learn It Rating: 3 out of 5 stars3/5C Programming Concepts Rating: 0 out of 5 stars0 ratingsRelational Database Systems Rating: 0 out of 5 stars0 ratingsSoftware Engineering & Object Oriented Modeling Rating: 0 out of 5 stars0 ratingsXHTML Rating: 0 out of 5 stars0 ratingsMicrosoft Access 2003 Rating: 5 out of 5 stars5/5
Related to C# Programming
Related ebooks
Mastering C# and .NET Framework Rating: 5 out of 5 stars5/5C Programming for Beginners: Your Guide to Easily Learn C Programming In 7 Days Rating: 4 out of 5 stars4/5Visual Basic .NET for complete beginners Rating: 5 out of 5 stars5/5Beginning Programming with C++ For Dummies Rating: 4 out of 5 stars4/5Json for Beginners: Your Guide to Easily Learn Json In 7 Days Rating: 3 out of 5 stars3/5A Quick Guide to c# with Unity: Quick Guides, #1 Rating: 5 out of 5 stars5/5Python 3 Programming: A Beginner Crash Course Guide to Learn Python 3 in 1 Week Rating: 3 out of 5 stars3/5Learn C++ Rating: 4 out of 5 stars4/5Beginning C++ Programming Rating: 3 out of 5 stars3/5Java: Programming: Your Step by Step Guide to Easily Learn Java in 7 Days Rating: 4 out of 5 stars4/5Programming Problems: A Primer for The Technical Interview Rating: 4 out of 5 stars4/5Android Studio Bumble Bee Essentials - Java Edition: Developing Android Apps Using Android Studio 2021.1 and Java Rating: 0 out of 5 stars0 ratingsVisual Studio 2022 In-Depth: Explore the Fantastic Features of Visual Studio 2022 - 2nd Edition Rating: 0 out of 5 stars0 ratingsSQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5Python 3 Object Oriented Programming Rating: 4 out of 5 stars4/5Advanced C Concepts and Programming: First Edition Rating: 3 out of 5 stars3/5Start-to-Finish Visual Basic 2015 Rating: 5 out of 5 stars5/5C Programming For Beginners: The Simple Guide to Learning C Programming Language Fast! Rating: 5 out of 5 stars5/5Java For Dummies Quick Reference Rating: 4 out of 5 stars4/5Software Engineering: Architecture-driven Software Development Rating: 4 out of 5 stars4/5Mastering C Pointers: Tools for Programming Power Rating: 2 out of 5 stars2/5Modern C++ Programming Cookbook Rating: 5 out of 5 stars5/5Essential Algorithms: A Practical Approach to Computer Algorithms Using Python and C# Rating: 5 out of 5 stars5/5Learning JavaScript Data Structures and Algorithms Rating: 5 out of 5 stars5/5C All-in-One Desk Reference For Dummies Rating: 5 out of 5 stars5/5Data Structures & Algorithms Interview Questions You'll Most Likely Be Asked Rating: 1 out of 5 stars1/5PROGRAMMING IN C# 10 - Basic Techniques Rating: 2 out of 5 stars2/5Responsive Web Design with HTML5 and CSS3 Rating: 4 out of 5 stars4/5Learning C# by Developing Games with Unity 2019 - Fourth Edition: Code in C# and build 3D games with Unity, 4th Edition Rating: 0 out of 5 stars0 ratings
Programming For You
Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Python QuickStart Guide: The Simplified Beginner's Guide to Python Programming Using Hands-On Projects and Real-World Applications Rating: 0 out of 5 stars0 ratingsCoding All-in-One For Dummies Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Learn SQL in 24 Hours Rating: 5 out of 5 stars5/5Mastering Windows PowerShell Scripting Rating: 4 out of 5 stars4/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratingsMinecraft Basics For Dummies Rating: 0 out of 5 stars0 ratingsPython Essentials Rating: 5 out of 5 stars5/5Teach Yourself C++ Rating: 4 out of 5 stars4/5TensorFlow in 1 Day: Make your own Neural Network Rating: 4 out of 5 stars4/5A Slackers Guide to Coding with Python: Ultimate Beginners Guide to Learning Python Quick Rating: 0 out of 5 stars0 ratingsSQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5SQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5Python Projects for Beginners: A Ten-Week Bootcamp Approach to Python Programming Rating: 0 out of 5 stars0 ratingsModern C++ for Absolute Beginners: A Friendly Introduction to C++ Programming Language and C++11 to C++20 Standards Rating: 0 out of 5 stars0 ratings
Reviews for C# Programming
5 ratings1 review
- Rating: 4 out of 5 stars4/5
As a beginner, it was fairly helpful as a reference document. Working step-by-step through construction of some fairly simple programs would have been useful.
Book preview
C# Programming - Jitendra Patel
C# Programming
By Jitendra Patel
Overview
C# Programming: This book is specially written for Microsoft's .Net Developers in Computer Engineering and Information Technologies fields. Also those who are interested learning C#.Net can refer this book gain knowledge about power of C# for develpoment of various .Net applications.
It covers virtually most of core features and some of the advanced features of C# Programming for dynamic website development including more than hands on examples tested through .NET. Most of code samples are presented in easy to use way through any simple text editor starting from notepad to rich editor like Microsoft Visual Studio.Net. Throughout the book most of the programming features are explained through syntax and examples to develop state-of-the-art Windows and Web applications using advanced concepts like Threading, GUI and other authentication features.
Copyright © 2012 Jitendra Patel
No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an as is
basis. The authors and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book.
Dedication
This book is dedicated to my honorable parents and beloved students who are my favorite person in the world.
PREFACE
I want to thank a number of people at my institute for helping us solve the difficulties of book and finding the solution of various critical problems I faced during writing the development.
As the reader of this book, you are my most important critic and commentator. I value your opinion and want to know what I am doing right, what I could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass my way.
As an author of this book, I welcome your comments. You can email or write me directly to let me know what you did or didn't like about this book as well as what I can do to make the book better.
When you write, please be sure to include this book's title and author as well as your name, email address, and phone number. I will carefully review your comments on the book.
Contents
Chapter 1. Introduction to C#
1.1 Introduction
1.2 Evolution of C#
1.3 Characteristics of C#
1.4 Applications of C#
1.5 Difference between C++ and C#
1.6 Difference between Java and C#
Questions and answers
Chapter 2. Understanding .NET strategy
2.1 The .NET Strategy
2.2 The Origins of .NET technology
2.3 The .NET Framework
2.4 The Common Language Runtime
2.5 Managed Code
2.6 Visual Studio.NET
2.7 . NET Languages
2.8 Benefits of .NET approach
2.9 C# and .NET
Questions and Answers
Chapter 3. Data Type, Literals and Variables.
3.1 Data Types
3.3 Variables
3.4 Default values of common data types
3.5 Scope of Variables
3.6 Constants
3.7 Boxing
3.8 Parameter Passing
Questions and Answers
Chapter 4 Operators and Expressions
4.1 C# Operators
4.2 Type conversion
Questions and Answers
Chapter 5 Decision Making and Branching
5.1 Decision Making With IF Statement
5.2 Nesting of IF… ELSE statement
5.4 The SWITCH statement
Questions and Answers
Chapter 6 Decision Making and Looping
6.1 Loop Structures
6.2 jumps in loops
Questions & Answers
Chapter 7 Methods in C#
7.1 Declaring a method.
7.2 Invoking Methods
7.4 Method Overloading
Questions & Answers
Chapter 8 Arrays
8.1 Creating a one-dimensional array.
8.2 Initializing one-dimensional arrays
8.3 Creation of two-dimensional array
8.4 Initializing two-dimensional arrays
8.5 Variable Size Arrays (Jagged Arrays)
8.6 Differences between Regular arrays and Jagged arrays
8.7 The System.Array class
8.8 The ArrayList Class
Questions & Answers
Chapter 9 Handling Strings
9.1 Immutable String.
9.2 Creating Strings
9.3 String Methods
9.4 MutableString( StringBuilder class )
9.5 Arrays of String
9.6 Regular Expressions
Questions & Answers
Chapter 10 Structures and Enumerations
10.1 Structures
10.2 Defining a Structure
10.3 Creating a structure instance
10.4 Nested Structures
10.5 Enumerations
10.6 Enumerator type conversion
Chapter 11 Classes and Objects
11.1 Basic principles of OOP’s
11.2 Class
11.3 Objects
11.4 Defining a class
11.5 Member Variables or Instance Variables
11.6 Methods
11.7 Creating Objects
11.8 Accessing Class Members
11.9 Constructors
11.10 Constructor Overloading
11.11 Static Members
11.12 Static Constructors
11.13 Private Constructors
11.14 Copy Constructor
11.15 Destructors
11.16 The this Reference
11.17 Constant Members
11.18 Read-Only Members
11.19 Properties
11.20 Indexers
Questions and Answers
Chapter 12 Inheritance and Polymorphism
12.1 Classical Inheritance
12.2 Containment Relation
12.3 Inheritance in C#
12.4 Defining Sub class constructors
12.5 Multilevel Inheritance
12.6 Hierarchical Inheritance
12.7 Constructors and Inheritance
12.8 Method Hiding
12.9 Method Overriding
12.10 Abstract methods
12.11 Abstract classes
12.12 Sealed Classes
12.13 Sealed methods
12.14 Inclusion Polymorphism or Dynamic binding
12.15 Operation Polymorphism or Static binding
Questions & Answers
Chapter 13 Interfaces
13.1 Introduction to Interfaces
13.2 Explicit interface member implementations
Questions and Answers
Chapter 14 Namespaces
14.1 Introduction to Namespace
14.2 Using namespace
Chapter 15 Delegates and Events
15.1 Delegates
15.2 Delegate Declaration
15.3 Delegate methods definition
15.4 Delegate instantiation
15.5 Delegate invocation
Chapter 1. Introduction to C#
1.1 Introduction
C# is a simple, modern, object-oriented, versionable, compatible, flexible, interoperable and type safe programming language originated from C and C++. It combines the prominent features of modern programming languages like C++, Java, Visual Basic, etc. It is used mainly to create .NET applications. The .NET is the most modern development platform of Microsoft that enables the development of component-based applications. The .NET platform supports more than 20 different languages and the list is growing day by day. The C# compiler is considered to be the most efficient compiler in the .NET family and a major part of the .NET base classes libraries itself are written in C#.
1.2 Evolution of C#
In the past two decades C and C++ were the most powerful and widely used languages for developing commercial and business softwares. These languages were often criticized for its longer development time and hence reduced productivity. So the developer community was longing for a highly productive and powerful language for their development needs. They required an environment that supports the emerging web standards and one that provides easy integration with existing applications. To address these problems Microsoft developed a platform called .NET. The alpha version of it was released in the mid of year 2000. Also in the same year Microsoft announced their C# language as a de fact language of the .NET platform. The C# compiler is considered to be the most efficient compiler in the .NET family and a major part of the .NET base classes libraries itself are written in C#.
1.3 Characteristics of C#
The major characteristics of C# are:
· Simple
C# was designed to be easy for the professional programmer to learn and use effectively. If you have some programming experience, you will not find C# hard to master. Also, some of the confusing concepts from C++ are either left out of C# or implemented in a clearer manner. Say for example the complex pointers in C++ are missing in C#. In C++ you have ::, . , -> operators for namespaces, member access and references respectively. But in C# a single dot ( . )