UNIT – I
C#.NET
C# is a modern, object-oriented, and type-safeprogramming language.C# enables
developers to build many types of secure and robust applications that run in .NET. C# has its
roots in the C family of languages and will be immediately familiar to C, C++, Java, and
JavaScript programmers.C# is an object-oriented, component-oriented programming language.
C# provides language constructs to directly support these concepts, making C# a natural
language in which to create and use software components.
Several C# features help create robust and durable applications.
Garbage collection automatically reclaims memory occupied by unreachable unused objects.
Nullable types guard against variables that don't refer to allocated objects.
Exception handling provides a structured and extensible approach to error detection and
recovery.
Lambda expressions support functional programming techniques.
Language Integrated Query (LINQ) syntax creates a common pattern for working with data
from any source.
. NET Enterprise Architecture
There are 3 important parts in .NET Architecture
1. Common language Runtime
2. .NET Base classes
3. User & Program Interface
Common Language Runtime:
It's a core runtime engine for executing applications in.NET Framework.it's a box inside
which dotted code run. This code is called managed code it is fully product It’s the environment
in which programs are being executed. It supports different codes to run on it. A compiler
converts source code into MSIL (Microsoft intermediate language).MSIL is CPU independent
program that can be converted to CPU dependent program.MSIL is language independent code.
A JIT compiler processes the combined code creating managed native code.older applications
that are not DOTNET run as usual in Windows.
.NET Base classes
These classes provide base classes the developer can use to implement application quickly.
Developers can use them by building objects from these classes and in open the class methods.
It includes several kinds of classes
classes and types related to basic database management
classes to debug in application to trace execution
classes that allow reading writing to files and other data sheets
classes that perform common mathematical operations
classes to inspect metadata of an assembly
classes to enable security capabilities
User & Program Interface:
It is the top layer of the dotnet architecture.
It includes Windows forms windows application services Windows forms, web forms and Web
Services.windows Forms are used to create win32 desktop application.Web forms provide a
powerful form based user interface for the Web. Web Services provide a mechanism for a
program to communicate over internet.COM/DCOM services used for object brokering and
interface
.NET framework architecture is shown in the below diagram
.NET Products:
R# (ReSharper):
ReSharper makes Visual Studio a much better IDE.ReSharper extends Visual Studio with
over 2200 on-the-fly code inspections for C#, VB.NET, ASP.NET, JavaScript, TypeScript and
other technologies. For most inspections, ReSharper provides quick-fixes to improve the code.
ReSharper features are
Code analysis
ReSharper extends Visual Studio with over 2200 on-the-fly code inspections for C#, VB.NET,
ASP.NET, JavaScript, TypeScript and other technologies.Find and remove unused code,Migrate
your code to the latest C# version, Convert loops to LINQ at will, Find and prevent possible
exceptions, Use a common naming standard. All are made possible with ReSharper's code
analysis.
Refactorings
60+ refactorings and 450+ context actions help safely organize code and move it around the
solution, distribute responsibility, decouple, decrease complexity, or simply use alternative
language syntax.
Navigation and search
ReSharper helps instantly get to any code in a solution, no matter how large the solution is. It can
also navigate you from any symbol to its related code such as implementations of a given
interface, extension methods of a class, or usages of a field.
Code generation
ReSharper can create a lot of code for you: from new files and classes to conditional blocks and
GUIDs; from methods and properties required by an interface being implemented to equality
checks and formatting members.
RD(Rider):
Rider is a cross-platform .NET IDE based on the IntelliJ platform and ReSharper.Rider provides
the power to productively develop a wide range of applications, including .NET desktop
applications, services and libraries, Unity and Unreal Engine games, Xamarin apps, ASP.NET,
and ASP.NET Core web applications, and more. On Windows, macOS, and Linux.
Rider features are
Code analysis: Rider boasts 2,200+ live code inspections, with automated quick-fixes to resolve
detected issues individually or in bulk.
Code editing: Rider's rich editor features different kinds of code completion and code templates,
auto-inserting matching braces and import directives, quick info tooltips and gutter icons for
inheritance navigation, context actions, and much more.
Refactorings: Most of ReSharper's 60+ refactorings are already available in Rider, and its 450+
context actions are all there. Rename, extract methods, interfaces and classes, move and copy
types, use alternative syntax, and a lot more!
Unit test runner:
Rider helps you run and debug unit tests based on NUnit, xUnit.net, or MSTest. You can
explore tests, group them in different ways, break them down into individual sessions, see test
output and navigate to source code from stack traces.
Debugger and more tools
Rider includes a debugger that works with .NET Framework, Mono and .NET Core applications,
letting you step, watch, evaluate, and run to cursor. Other tools include a stack trace explorer,
NuGet browser, and VCS and database support.
Databases and SQL
Work with SQL and databases without leaving Rider. Connect to databases, edit schemas and
table data, run queries, and even analyze schemas with UML diagrams.
Navigation and search
Jump to any file, type, or member in your code base instantly, as well as quickly find settings
and actions. Find usages of any symbol, or navigate from a symbol to the base and derived
symbols, extension methods, or implementations.
Front-end technologies
Rider comes with JavaScript, TypeScript, HTML, CSS and Sass support built in. Take advantage
of the refactorings, debugging, and unit testing capabilities included from WebStorm.
Extensibility
True to its roots, Rider supports a wide array of plugins developed for ReSharper and IntelliJ
Platform.
DC(dotCover)
dotCover is a .NET unit test runner and code coverage tool that integrates with Visual
Studio and JetBrainsRider.Make sure you know to what extent your code is covered with unit
tests. dotCover calculates and reports statement-level code coverage in applications targeting
.NET Framework, .NET Core, Mono, or Mono for Unity.
dotCoverfeatures are
Unit tests
Execute and debug unit tests and run coverage analysis of unit tests in Visual Studio or using the
command-line utility. dotCover supports many unit testing frameworks including MSTest,
NUnit, xUnit, and MSpec.
Manual test sessions
For manual test sessions, dotCover shows what parts of code were called during the session and
which parts were not reached. Using the coverage analysis data, you can easily get to the source
code of the tested application.
Detecting hot spots
Detect potential risk areas at a glance with Hot Spots view, which shows the most complex
methods with the least coverage. Get your coverage analysis off to a good start with an intuitive
graphical representation .
Seamless integration with Visual Studio and JetBrains Rider
dotCover integrates with Visual Studio and JetBrains Rider, giving you the advantage of
analyzing and visualizing code coverage without leaving the code editor. It supports Visual
Studio 2010–2017 and JetBrains Rider 2018.2 or later.
Continuous testing
dotCover can figure out on-the-fly which unit tests are affected by your latest code changes, and
automatically re-runs the affected tests for you.The continuous testing mode can be switched on
for any unit test session: this way you can choose which tests you want to run continuously and
which to run the traditional way.
DM(dotMemory)
dotMemory allows you to analyze memory usage in a variety of .NET and .NET Core
applications: desktop applications, Windows services, ASP.NET web applications, IIS, IIS
Express, arbitrary .NET processes, and more.
dotMemory features are
Easily control the profiling process
Use the timeline view to monitor the memory consumed by your application in real time. Collect
the info on allocations as you need it.
Collect profiling data
Take snapshots with a single click without stopping your profiling session, add them to compare
or browse memory traffic during a particular timeframe.
Auto-detect issues
Thanks to the multiple powerful built-in inspections, most common memory issues are detected
with a single click, no manual effort required. Just get a snapshot and be guided toward
optimizing the memory usage.
Analyse deeper
For in-depth analysis, dotMemory offers many different criteria to apply to memory usage data,
so you can view the data from thousands of different angles, and drill-down, dice, slice or pivot
as you wish.
Determine traffic
Analyse memory traffic in a particular timeframe to understand the cause of excessive
allocations and garbage collections. Determine how objects were allocated and collected and
what methods are behind these allocations.
DT(dot.Trace)
dotTrace helps you detect performance bottlenecks in a variety of .NET and .NET Core
applications: WPF and Universal Windows Platform, ASP.NET, Windows services, WCF
services, and unit tests. Mono and Unity applications are supported as well.
dotTrace features are
Analyze any performance issues
Get accurate data on calls execution time. In the timeline profiling mode, get the same call time
data but bound to a timeline. Use timeline data to analyze performance issues where the order of
events matters, such as UI freezes, excessive garbage collection, uneven workload distribution,
inefficient file I/O, and others.
Profile SQL queries and HTTP requests
Find out how a particular query affects application performance and why this query is running
slow.If you develop a web application, learn how it processes incoming HTTP requests.
Profile static methods and unit tests
You can instantly get comprehensive profiling data without having to build your solution, run the
profiler and perform a usage scenario. Just add a static method alongside the code that you're
optimizing, and profile it!If you employ unit testing in your project, dotTrace helps you profile
any test in just a few clicks. In addition, dotTrace offers a special TeamCity plugin which you
can use to profile integration tests on your CI server and prevent performance regressions.
Profile and analyze results in Rider and Visual Studio
With dotTrace, you can profile and analyze call stacks without leaving your IDE. It is already
integrated into Visual Studio and JetBrainsRider.You can even navigate to a method declaration
from a hot spot in the call tree.
.NET Services
.NET services are quite popular these days. The development of Windows-based services
and web-based services are on rise. The users can easily make use of the services without having
to look into the implementation details or know how they work in the first place. There are few
advantages of going for .NET services and they are:
Makes communication between applications easier
Rapid development
Easy to distribute information
Less cost and easy maintenance
Web services enjoy data interoperability due to XML use
Lightweight architecture
Less application and image loading time
.NET APIs comes with built-in testing feature which detects mistakes automatically
while coding