- December 12, 2021
- Nikolay Kostov (Nikolay.IT)
Topics covered:
- What is Computer Programming?
- Your First C# Program
- What is .NET Framework?
- What is Visual Studio?
Video (in Bulgarian)
Presentation Content
Define: Computer Programming
Computer programming : creating a sequence of instructions to enable the computer to do something
Programming Phases
- Define a task/problem
- Plan your solution
- Find suitable algorithm to solve it
- Find suitable data structures to use
- Write code
- Fix program error (bugs)
- Make your customer happy
- Phases
- Specification
- Design
- Implementation
- Testing & Debugging
- Deployment
First Look at C#
Sample C# program:
using System;
class HelloCSharp
{
static void Main()
{
Console.WriteLine("Hello, C#");
}
}
What is “C#”?
- Programming language
- Asyntax thatallow to give instructions to the computer
- C# features:
- New cutting edge language
- Extremely powerful
- Easy to learn
- Easy to read and understand
- Object-oriented
What You Need to Program?
- Knowledge of a programming language
- Task to solve
- Developmentenvironment, compilers, SDK
- Visual Studio , .NET Framework SDK
- Set of usefulstandard classes
- Microsoft .NET Framework FCL
- Help documentation
What is .NET Framework?
- Environment for execution of .NETprograms
- Powerful library of classes
- Programming model
- Commonexecution engine formany programming languages
- C#
- Visual Basic .NET
- Managed C++
- ... and many others
Inside .NET Framework
Building blocks of .NET Framework:
- ASP.NET
- Web Forms, MVC, Web API, SignalR
- WCF and WWF (Communication and Workflow Tier)
- ADO.NET, EF, LINQ and XML (Data Tier)
- Base Class Library (BCL)
- Common Language Runtime (CLR)
- Operating System (OS)
CLR – The Heart of .NET Framework
- Common Language Runtime (CLR)
- Managed execution environment
- Executes .NET applications
- Controls the execution process
- Automatic memory management(garbage collection)
- Programminglanguagesintegration
- Multiple versions support for assemblies
- Integratedtype safetyand security
Framework Class Library
- Framework Class Library (FCL)
- Provides basic functionality to developers:
- Console applications
- WPF and Silverlight rich-media applications
- Windows Forms GUI applications
- Web applications (dynamic Web sites)
- Web services,communication and workflow
- Server & desktop applications
- Applications for mobile devices
Visual Studio
- Visual Studio – Integrated Development Environment (IDE)
- Development tool that helps us to:
- Write code
- Design user interface
- Compile code
- Execute / test / debug applications
- Browse the help
- Manage project’s files
Benefits of Visual Studio
- Single tool for:
- Writing code in many languages (C#, VB, …)
- Using different technologies (Web, WPF, …)
- For different platforms (.NET CF, Silverlight, …)
- Full integration of most development activities (coding, compiling, testing, debugging, deployment, version control, ...)
- Very easy to use!
Creating New Console Application
- File -> New -> Project ...
- Choose C# console application
- Choose project directory and name
- Visual Studio creates some source code for you
Compiling Source Code
- The process of compiling includes:
- Syntactic checks
- Type safety checks
- Translation of the source code to lower level language (MSIL)
- Creating of executable files (assemblies)
- You can start compilation by
- Using Build->Build Solution/Project
- Pressing [ F6] or [Shift+Ctrl+B]
Running Programs
- The process of running application includes:
- Compiling (if project not compiled)
- Starting the application
- You can run application by:
- Using Debug->Start menu
- By pressing [F5] or [Ctrl+F5]
- * NOTE: Not all types of projects are able to be started!
Debugging The Code
- The process of debugging application includes:
- Spotting an error
- Finding the lines of code that cause the error
- Fixing the code
- Testing to check if the error is gone and no errors are introduced
- Iterative and continuous process
Debugging in Visual Studio
- Visual Studio has built-in debugger
- It provides:
- Breakpoints
- Ability to trace the code execution
- Ability to inspect variables at runtime
What Is a Blank Solution?
- A Visual Studio blank solution
- Solution with no projects in it
- Projects to be added later
- What is the point?
- Not making a project just to give proper name
- And not working in this project
What is MSDN Library?
- Complete documentation of all classes and their functionality
- With descriptions of all methods, properties, events, etc.
- With code examples
- Related articles
- Library of samples
- Use local copy or the Web version at http://msdn.microsoft.com/