This document provides an introduction to the C# programming language. It outlines prerequisites, learning objectives, and an agenda. The agenda includes an overview of C#'s design goals like component orientation and everything being an object. It also covers C# fundamentals like types, program structure, statements, operators, and using Visual Studio.NET and the .NET framework. Types discussed include value types like integral and floating point numbers as well as reference types like strings and objects.
This document provides an introduction and overview of the C# programming language. It discusses prerequisites, learning objectives, and the agenda. It covers Hello World examples, design goals of C#, types including value types and reference types, program structure, statements, operators, and using Visual Studio and the .NET framework. Key topics are the unified type system in C#, value types vs reference types, boxing and unboxing, predefined types like integers and strings, and object being the root type.
This document provides information about the C# programming language. It discusses that C# is an object-oriented language that can be used to build a variety of applications like Windows and web. Visual C# .NET is Microsoft's integrated development environment (IDE) for building C# applications and is part of the Visual Studio suite. The document also covers C# language fundamentals like variables, data types, operators, and conditional statements.
The document introduces C# and discusses its key features. It describes C# as the first component-oriented language in the C/C++ family, where everything is an object, and which enables robust and durable software through features like garbage collection and exceptions. It also discusses how C# preserves investments in existing software and languages through interoperability. The document provides overviews of major C# concepts like its type system, classes, interfaces, attributes, and statements.
The document introduces C# and discusses its key features. It describes C# as the first component-oriented language in the C/C++ family, where everything is an object and it enables robust and durable software through features like garbage collection and exceptions. It also discusses how C# preserves investments in existing software and languages through interoperability. The document provides overviews of major C# concepts like its type system, classes, interfaces, attributes and statements.
The document introduces C# and discusses its key features. It describes C# as the first component-oriented language in the C/C++ family, where everything is an object and it enables robust and durable software through features like garbage collection and exceptions. It also discusses how C# preserves investments in existing software and languages through interoperability. The document provides overviews of major C# concepts like its type system, classes, interfaces, attributes and statements.
C# is a component-oriented language that introduces object-oriented improvements to the C/C++ family of languages. Key features include garbage collection, exceptions, type safety, and preservation of investments in C++. C# supports classes, interfaces, structs, enums, delegates and events to provide a unified object model.
C# is a component-oriented language that introduces object-oriented improvements to the C/C++ family of languages. Key features include garbage collection, exceptions, type safety, and preservation of C++ investments like namespaces and enums. Everything in C# is an object, unifying value and reference types without performance penalties. The language supports robust features like properties, events, generics and attributes to enable component-based development.
This document provides an introduction and overview of the C# programming language. It discusses prerequisites, learning objectives, and the agenda. It covers Hello World examples, design goals of C#, types including value types and reference types, program structure, statements, operators, and using Visual Studio and the .NET framework. Key topics are the unified type system in C#, value types vs reference types, boxing and unboxing, predefined types like integers and strings, and object being the root type.
This document provides information about the C# programming language. It discusses that C# is an object-oriented language that can be used to build a variety of applications like Windows and web. Visual C# .NET is Microsoft's integrated development environment (IDE) for building C# applications and is part of the Visual Studio suite. The document also covers C# language fundamentals like variables, data types, operators, and conditional statements.
The document introduces C# and discusses its key features. It describes C# as the first component-oriented language in the C/C++ family, where everything is an object, and which enables robust and durable software through features like garbage collection and exceptions. It also discusses how C# preserves investments in existing software and languages through interoperability. The document provides overviews of major C# concepts like its type system, classes, interfaces, attributes, and statements.
The document introduces C# and discusses its key features. It describes C# as the first component-oriented language in the C/C++ family, where everything is an object and it enables robust and durable software through features like garbage collection and exceptions. It also discusses how C# preserves investments in existing software and languages through interoperability. The document provides overviews of major C# concepts like its type system, classes, interfaces, attributes and statements.
The document introduces C# and discusses its key features. It describes C# as the first component-oriented language in the C/C++ family, where everything is an object and it enables robust and durable software through features like garbage collection and exceptions. It also discusses how C# preserves investments in existing software and languages through interoperability. The document provides overviews of major C# concepts like its type system, classes, interfaces, attributes and statements.
C# is a component-oriented language that introduces object-oriented improvements to the C/C++ family of languages. Key features include garbage collection, exceptions, type safety, and preservation of investments in C++. C# supports classes, interfaces, structs, enums, delegates and events to provide a unified object model.
C# is a component-oriented language that introduces object-oriented improvements to the C/C++ family of languages. Key features include garbage collection, exceptions, type safety, and preservation of C++ investments like namespaces and enums. Everything in C# is an object, unifying value and reference types without performance penalties. The language supports robust features like properties, events, generics and attributes to enable component-based development.
C# is an object-oriented programming language that is simple, modern and type-safe, derived from C and C++. It aims to combine the high productivity of Visual Basic with the power of C++. C# programs are typically written in .cs files and compiled to .exe files using the Visual Studio IDE and command line compiler. The language uses the .NET framework class library and supports value types that contain data and reference types that store references to objects.
C# is an object-oriented programming language where programs consist of objects that interact through methods. The document discusses C# program structure, sample code, how code is executed, and data types in C#. It provides details on value types like integers and floats, reference types like strings, and pointer types. Key features of C# include being case sensitive and requiring semicolons. The document also covers operators, variables, and keywords in C#.
The document provides an introduction to the C# programming language. It discusses some of the key ideas and concepts of C# including that it is a component-oriented language where everything is an object. It aims to provide robust and durable software through features like garbage collection, exceptions, and type safety. C# also aims to preserve investments in existing code through interoperability and allowing C++ constructs. The document then provides examples and explanations of various C# language features like classes, structs, interfaces, properties, events, and attributes.
C# is a component-oriented language that introduces object-oriented improvements to the C/C++ family of languages. Everything in C# is an object, providing a unified type system without performance costs. C# aims to produce robust, durable software using techniques like garbage collection and exceptions, while preserving investments in existing C/C++ code through interoperability. The document provides an overview of key C# concepts like classes, interfaces, attributes, events, operators and more.
C# is a component-oriented language that introduces object-oriented improvements to the C/C++ family of languages. Everything in C# is an object, providing a unified type system without performance costs. C# aims to produce robust, durable software using techniques like garbage collection and exceptions, while preserving investments in existing C/C++ code through interoperability. The document provides an overview of key C# concepts like classes, interfaces, attributes, and events to illustrate how C# supports component-based development.
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...NALESVPMEngg
The document provides an introduction to the C# programming language. It discusses some of the key ideas and concepts of C# including that it is a component-oriented language where everything is an object. It aims to provide robust and durable software through features like garbage collection, exceptions, and type safety. C# also aims to preserve investments in existing code through interoperability and allowing C++ constructs. The document then provides examples and explanations of various C# language features like classes, structs, interfaces, properties, events, and attributes.
This document provides information on various .NET and C# concepts:
1. It begins with an example C# program that multiplies two numbers and prints the result, demonstrating basic program structure and comments.
2. It then covers identifiers, keywords, single-line and multi-line comments in C#, and the differences between value types and reference types.
3. The document concludes by discussing object-oriented programming concepts in C# like classes, constructors, destructors, methods, inheritance, polymorphism, abstraction, interfaces, and abstract classes.
The document provides an introduction to C# programming, including:
- C# was developed by Microsoft for the .NET framework and is based on C and C++.
- Visual Studio is used to create C# projects and console applications.
- A basic "Hello World" console app is demonstrated using Console.WriteLine().
- Common data types like int, string, char, and boolean are explained.
The document provides an overview of C# program structure including comments, identifiers, classes, methods, data types, variables, and input/output. Some key points:
- C# uses single-line and multi-line comments for documentation.
- Identifiers name variables, classes, and methods using letters, digits and underscores with case sensitivity.
- A class contains methods and defines the structure of an object. The Main method is entry point for console apps.
- Built-in data types include integers, floats, decimals, booleans, characters and strings.
- Variables store values of a specific data type and are declared with type and name. Constants are similar but values cannot change.
- Console
C# programs use namespaces and classes. A class defines methods and variables. C# supports inheritance, interfaces, structs, and enums. The main method runs code. Common data types include primitive types like int and reference types like string. C# can read input, perform math operations, and conditionally execute code using if/else statements. Methods can pass parameters by value or reference.
The document discusses the role of CLR (Common Language Runtime) in .NET framework. It explains that CLR converts programs to native code, handles exceptions, provides type safety, memory management, security, improved performance and is language and platform independent. It also discusses garbage collection and language features supported by CLR. The main components of CLR are CTS (Common Type System), JIT (Just-In-Time) compiler and CLS (Common Language Specification). CTS defines value and reference types while JIT compiles CIL to machine code. CLS provides language interoperability.
434090527-C-Cheat-Sheet. pdf C# programMAHESHV559910
The document provides an introduction and overview of C# programming basics including:
- C# was developed by Microsoft for the .NET framework and is based on C and C++.
- Visual Studio can be used to create and run C# console applications, using templates like Console App.
- A basic "Hello World" C# console app is demonstrated using Console.WriteLine().
- Common data types in C# include primitive types like int and bool, as well as reference types like string.
This document provides an overview of C# and .NET framework concepts including:
- C# is a type-safe, object-oriented language that runs on the .NET framework and CLR.
- Key C# concepts covered include variables, value types, reference types, classes, interfaces, inheritance, namespaces, operators, and control flow statements.
- The .NET framework provides a common language runtime, class library, and tools for building applications across platforms.
PERTEMUAN 1 - MENGENAL ENVIRONTMENT PROGRAM VISUAL C#.pptxTriSandhikaJaya
This document introduces C# and provides an agenda that includes Hello World, the .NET Framework, the design goals of C#, and C# language features. The .NET Framework section describes the Common Language Runtime and services like ASP.NET and Windows Forms. The design goals section explains that C# is a component-oriented language that aims for simplicity, robustness, and preserving investments in other languages. The language features section provides an overview of key elements of the C# language like classes, structs, interfaces, and events.
The document discusses C# and .NET programming concepts. It states that C# is the primary language for .NET development and provides an overview of key C# concepts like variables, data types, operators, control flow statements, classes, objects, inheritance, polymorphism, and the differences between classes and structures. It also covers arrays, namespaces, properties, and common .NET modifiers like public, private, and static.
The document discusses C# and the .NET framework. It covers:
- The goals and components of the .NET framework, including the common language runtime (CLR) and class library.
- Key concepts in .NET like value types, reference types, boxing/unboxing, and the unified type system.
- Features that enable component-oriented development in C# like properties, events, and attributes.
- Productivity features of C# like parameter arrays, ref/out parameters, and foreach loops.
The document provides an overview of the .NET platform and C# programming language. It discusses the .NET framework and common language runtime (CLR), introduces C# components like classes and delegates, and covers ASP.NET web development fundamentals such as the page lifecycle, master pages, and application/session state.
The document provides an overview of getting started with C#, including:
- An introduction to C# and its evolution from versions 1.0 to 9.0.
- Key topics covered include data types, variables, value types vs reference types, and keywords.
- Coding standards, sample programs, and operators are also discussed to help newcomers get up and running with C#.
The document outlines topics related to C# programming including fundamentals, data types, expressions, debugging, conditional statements, loops, classes, methods, and other concepts. It provides descriptions and examples for key elements like declaring variables, defining classes and objects, boxing and unboxing value types, namespaces, and more. The document appears to be serving as a course outline or guide for learning C#.
Esoft Metro Campus - Diploma in Information Technology - (Module IX) Programming with C#.NET
(Template - Virtusa Corporate)
Contents:
Introduction to .NET Framework
.NET Framework Platform Architecture
Microsoft Visual Studio
C# Language
C#, VS and .NET Framework Versions
Your First C# Application
Printing Statements
Comments in C#
Common Type System
Value Types and Reference Type
Variables Declaration in C#
Type Conversion
Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
If Statement
If… Else Statement
If… Else if… Else Statement
Nested If Statement
Switch Statement
While Loop
Do While Loop
For Loop
Arrays
Accessing Arrays using foreach Loop
Two Dimensional Arrays
Classes and Objects in C#
Inheritance in C#
Partial Classes
Namespaces
Windows Forms Applications
Using Buttons, Labels and Text Boxes
Displaying Message Boxes
Error Handling with Try… Catch… finally…
Using Radio Buttons
Using Check Boxes
Using List Boxes
Creating Menus
Creating ToolStrips
MDI Forms
Database Application in C#
Creating a Simple Database Application
SQL Insert / Update / Retrieving / Delete
SQL Command Execute Methods
Data Sets
This document provides an overview of front-end web development. It begins by defining a website and web development. It then discusses different types of web developers, including front-end developers who work with HTML, CSS, and JavaScript to define the visual design and user interface. The document also briefly introduces back-end development with server-side languages. Finally, it provides short descriptions of HTML for page structure, CSS for styling, and JavaScript for interactive elements.
This document provides an introduction to the C# programming language. It outlines prerequisites, learning objectives, and an agenda. The agenda includes an overview of C# design goals like component orientation and everything being an object. It also covers C# fundamentals like types, program structure, statements, operators, and using Visual Studio.NET and the .NET framework. Key points are made about C# having a unified type system where all data is an object and value and reference types can be treated polymorphically using boxing and unboxing.
C# is an object-oriented programming language that is simple, modern and type-safe, derived from C and C++. It aims to combine the high productivity of Visual Basic with the power of C++. C# programs are typically written in .cs files and compiled to .exe files using the Visual Studio IDE and command line compiler. The language uses the .NET framework class library and supports value types that contain data and reference types that store references to objects.
C# is an object-oriented programming language where programs consist of objects that interact through methods. The document discusses C# program structure, sample code, how code is executed, and data types in C#. It provides details on value types like integers and floats, reference types like strings, and pointer types. Key features of C# include being case sensitive and requiring semicolons. The document also covers operators, variables, and keywords in C#.
The document provides an introduction to the C# programming language. It discusses some of the key ideas and concepts of C# including that it is a component-oriented language where everything is an object. It aims to provide robust and durable software through features like garbage collection, exceptions, and type safety. C# also aims to preserve investments in existing code through interoperability and allowing C++ constructs. The document then provides examples and explanations of various C# language features like classes, structs, interfaces, properties, events, and attributes.
C# is a component-oriented language that introduces object-oriented improvements to the C/C++ family of languages. Everything in C# is an object, providing a unified type system without performance costs. C# aims to produce robust, durable software using techniques like garbage collection and exceptions, while preserving investments in existing C/C++ code through interoperability. The document provides an overview of key C# concepts like classes, interfaces, attributes, events, operators and more.
C# is a component-oriented language that introduces object-oriented improvements to the C/C++ family of languages. Everything in C# is an object, providing a unified type system without performance costs. C# aims to produce robust, durable software using techniques like garbage collection and exceptions, while preserving investments in existing C/C++ code through interoperability. The document provides an overview of key C# concepts like classes, interfaces, attributes, and events to illustrate how C# supports component-based development.
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...NALESVPMEngg
The document provides an introduction to the C# programming language. It discusses some of the key ideas and concepts of C# including that it is a component-oriented language where everything is an object. It aims to provide robust and durable software through features like garbage collection, exceptions, and type safety. C# also aims to preserve investments in existing code through interoperability and allowing C++ constructs. The document then provides examples and explanations of various C# language features like classes, structs, interfaces, properties, events, and attributes.
This document provides information on various .NET and C# concepts:
1. It begins with an example C# program that multiplies two numbers and prints the result, demonstrating basic program structure and comments.
2. It then covers identifiers, keywords, single-line and multi-line comments in C#, and the differences between value types and reference types.
3. The document concludes by discussing object-oriented programming concepts in C# like classes, constructors, destructors, methods, inheritance, polymorphism, abstraction, interfaces, and abstract classes.
The document provides an introduction to C# programming, including:
- C# was developed by Microsoft for the .NET framework and is based on C and C++.
- Visual Studio is used to create C# projects and console applications.
- A basic "Hello World" console app is demonstrated using Console.WriteLine().
- Common data types like int, string, char, and boolean are explained.
The document provides an overview of C# program structure including comments, identifiers, classes, methods, data types, variables, and input/output. Some key points:
- C# uses single-line and multi-line comments for documentation.
- Identifiers name variables, classes, and methods using letters, digits and underscores with case sensitivity.
- A class contains methods and defines the structure of an object. The Main method is entry point for console apps.
- Built-in data types include integers, floats, decimals, booleans, characters and strings.
- Variables store values of a specific data type and are declared with type and name. Constants are similar but values cannot change.
- Console
C# programs use namespaces and classes. A class defines methods and variables. C# supports inheritance, interfaces, structs, and enums. The main method runs code. Common data types include primitive types like int and reference types like string. C# can read input, perform math operations, and conditionally execute code using if/else statements. Methods can pass parameters by value or reference.
The document discusses the role of CLR (Common Language Runtime) in .NET framework. It explains that CLR converts programs to native code, handles exceptions, provides type safety, memory management, security, improved performance and is language and platform independent. It also discusses garbage collection and language features supported by CLR. The main components of CLR are CTS (Common Type System), JIT (Just-In-Time) compiler and CLS (Common Language Specification). CTS defines value and reference types while JIT compiles CIL to machine code. CLS provides language interoperability.
434090527-C-Cheat-Sheet. pdf C# programMAHESHV559910
The document provides an introduction and overview of C# programming basics including:
- C# was developed by Microsoft for the .NET framework and is based on C and C++.
- Visual Studio can be used to create and run C# console applications, using templates like Console App.
- A basic "Hello World" C# console app is demonstrated using Console.WriteLine().
- Common data types in C# include primitive types like int and bool, as well as reference types like string.
This document provides an overview of C# and .NET framework concepts including:
- C# is a type-safe, object-oriented language that runs on the .NET framework and CLR.
- Key C# concepts covered include variables, value types, reference types, classes, interfaces, inheritance, namespaces, operators, and control flow statements.
- The .NET framework provides a common language runtime, class library, and tools for building applications across platforms.
PERTEMUAN 1 - MENGENAL ENVIRONTMENT PROGRAM VISUAL C#.pptxTriSandhikaJaya
This document introduces C# and provides an agenda that includes Hello World, the .NET Framework, the design goals of C#, and C# language features. The .NET Framework section describes the Common Language Runtime and services like ASP.NET and Windows Forms. The design goals section explains that C# is a component-oriented language that aims for simplicity, robustness, and preserving investments in other languages. The language features section provides an overview of key elements of the C# language like classes, structs, interfaces, and events.
The document discusses C# and .NET programming concepts. It states that C# is the primary language for .NET development and provides an overview of key C# concepts like variables, data types, operators, control flow statements, classes, objects, inheritance, polymorphism, and the differences between classes and structures. It also covers arrays, namespaces, properties, and common .NET modifiers like public, private, and static.
The document discusses C# and the .NET framework. It covers:
- The goals and components of the .NET framework, including the common language runtime (CLR) and class library.
- Key concepts in .NET like value types, reference types, boxing/unboxing, and the unified type system.
- Features that enable component-oriented development in C# like properties, events, and attributes.
- Productivity features of C# like parameter arrays, ref/out parameters, and foreach loops.
The document provides an overview of the .NET platform and C# programming language. It discusses the .NET framework and common language runtime (CLR), introduces C# components like classes and delegates, and covers ASP.NET web development fundamentals such as the page lifecycle, master pages, and application/session state.
The document provides an overview of getting started with C#, including:
- An introduction to C# and its evolution from versions 1.0 to 9.0.
- Key topics covered include data types, variables, value types vs reference types, and keywords.
- Coding standards, sample programs, and operators are also discussed to help newcomers get up and running with C#.
The document outlines topics related to C# programming including fundamentals, data types, expressions, debugging, conditional statements, loops, classes, methods, and other concepts. It provides descriptions and examples for key elements like declaring variables, defining classes and objects, boxing and unboxing value types, namespaces, and more. The document appears to be serving as a course outline or guide for learning C#.
Esoft Metro Campus - Diploma in Information Technology - (Module IX) Programming with C#.NET
(Template - Virtusa Corporate)
Contents:
Introduction to .NET Framework
.NET Framework Platform Architecture
Microsoft Visual Studio
C# Language
C#, VS and .NET Framework Versions
Your First C# Application
Printing Statements
Comments in C#
Common Type System
Value Types and Reference Type
Variables Declaration in C#
Type Conversion
Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
If Statement
If… Else Statement
If… Else if… Else Statement
Nested If Statement
Switch Statement
While Loop
Do While Loop
For Loop
Arrays
Accessing Arrays using foreach Loop
Two Dimensional Arrays
Classes and Objects in C#
Inheritance in C#
Partial Classes
Namespaces
Windows Forms Applications
Using Buttons, Labels and Text Boxes
Displaying Message Boxes
Error Handling with Try… Catch… finally…
Using Radio Buttons
Using Check Boxes
Using List Boxes
Creating Menus
Creating ToolStrips
MDI Forms
Database Application in C#
Creating a Simple Database Application
SQL Insert / Update / Retrieving / Delete
SQL Command Execute Methods
Data Sets
This document provides an overview of front-end web development. It begins by defining a website and web development. It then discusses different types of web developers, including front-end developers who work with HTML, CSS, and JavaScript to define the visual design and user interface. The document also briefly introduces back-end development with server-side languages. Finally, it provides short descriptions of HTML for page structure, CSS for styling, and JavaScript for interactive elements.
This document provides an introduction to the C# programming language. It outlines prerequisites, learning objectives, and an agenda. The agenda includes an overview of C# design goals like component orientation and everything being an object. It also covers C# fundamentals like types, program structure, statements, operators, and using Visual Studio.NET and the .NET framework. Key points are made about C# having a unified type system where all data is an object and value and reference types can be treated polymorphically using boxing and unboxing.
Programming Lesson by Slidesgo - Copy.pptxReemaAsker1
This document provides an overview of HTML document structure and formatting. It discusses HTML elements like headings, horizontal lines, line breaks, and text formatting. It also mentions the <quote> tag. The document contains several sections on HTML formatting and structure.
This document contains a presentation template with sections for an opening, speakers, and introduction. The template includes multiple slides on each section with layouts, charts, and examples of the types of content that can be included, such as an agenda, timeline, or descriptions of services. It also provides instructions on how to customize the template by changing colors, photos, and text and use it as a theme in Google Slides. The template is intended to help users create formal presentations.
The document discusses several design patterns including Singleton, Factory, Chain of Responsibility, Adapter, Strategy, Composite, and Observer patterns. It provides descriptions of each pattern including their intent, participants, relationships between participants, and examples. The Singleton pattern ensures only one instance of a class is created while the Factory pattern abstracts object creation. Chain of Responsibility passes requests between handlers in a chain until one handles it. Adapter converts one interface to another while Strategy makes behaviors interchangeable. Composite represents part-whole hierarchies and Observer notifies dependents of state changes.
CMS requires IT project proposals to complete a Business Case outlining the proposal for evaluation. The Business Case allows a Governance Review Team and Board to strategically manage the IT portfolio by evaluating, advising on, and approving or denying projects. It should describe the business need, benefits to CMS, alignment with priorities, performance measures, at least three alternatives considered with pros/cons and costs, and estimated total life cycle costs. Completing the Business Case facilitates review of proposals within CMS' Target Life Cycle governance framework.
Embedded machine learning-based road conditions and driving behavior monitoringIJECEIAES
Car accident rates have increased in recent years, resulting in losses in human lives, properties, and other financial costs. An embedded machine learning-based system is developed to address this critical issue. The system can monitor road conditions, detect driving patterns, and identify aggressive driving behaviors. The system is based on neural networks trained on a comprehensive dataset of driving events, driving styles, and road conditions. The system effectively detects potential risks and helps mitigate the frequency and impact of accidents. The primary goal is to ensure the safety of drivers and vehicles. Collecting data involved gathering information on three key road events: normal street and normal drive, speed bumps, circular yellow speed bumps, and three aggressive driving actions: sudden start, sudden stop, and sudden entry. The gathered data is processed and analyzed using a machine learning system designed for limited power and memory devices. The developed system resulted in 91.9% accuracy, 93.6% precision, and 92% recall. The achieved inference time on an Arduino Nano 33 BLE Sense with a 32-bit CPU running at 64 MHz is 34 ms and requires 2.6 kB peak RAM and 139.9 kB program flash memory, making it suitable for resource-constrained embedded systems.
Rainfall intensity duration frequency curve statistical analysis and modeling...bijceesjournal
Using data from 41 years in Patna’ India’ the study’s goal is to analyze the trends of how often it rains on a weekly, seasonal, and annual basis (1981−2020). First, utilizing the intensity-duration-frequency (IDF) curve and the relationship by statistically analyzing rainfall’ the historical rainfall data set for Patna’ India’ during a 41 year period (1981−2020), was evaluated for its quality. Changes in the hydrologic cycle as a result of increased greenhouse gas emissions are expected to induce variations in the intensity, length, and frequency of precipitation events. One strategy to lessen vulnerability is to quantify probable changes and adapt to them. Techniques such as log-normal, normal, and Gumbel are used (EV-I). Distributions were created with durations of 1, 2, 3, 6, and 24 h and return times of 2, 5, 10, 25, and 100 years. There were also mathematical correlations discovered between rainfall and recurrence interval.
Findings: Based on findings, the Gumbel approach produced the highest intensity values, whereas the other approaches produced values that were close to each other. The data indicates that 461.9 mm of rain fell during the monsoon season’s 301st week. However, it was found that the 29th week had the greatest average rainfall, 92.6 mm. With 952.6 mm on average, the monsoon season saw the highest rainfall. Calculations revealed that the yearly rainfall averaged 1171.1 mm. Using Weibull’s method, the study was subsequently expanded to examine rainfall distribution at different recurrence intervals of 2, 5, 10, and 25 years. Rainfall and recurrence interval mathematical correlations were also developed. Further regression analysis revealed that short wave irrigation, wind direction, wind speed, pressure, relative humidity, and temperature all had a substantial influence on rainfall.
Originality and value: The results of the rainfall IDF curves can provide useful information to policymakers in making appropriate decisions in managing and minimizing floods in the study area.
Advanced control scheme of doubly fed induction generator for wind turbine us...IJECEIAES
This paper describes a speed control device for generating electrical energy on an electricity network based on the doubly fed induction generator (DFIG) used for wind power conversion systems. At first, a double-fed induction generator model was constructed. A control law is formulated to govern the flow of energy between the stator of a DFIG and the energy network using three types of controllers: proportional integral (PI), sliding mode controller (SMC) and second order sliding mode controller (SOSMC). Their different results in terms of power reference tracking, reaction to unexpected speed fluctuations, sensitivity to perturbations, and resilience against machine parameter alterations are compared. MATLAB/Simulink was used to conduct the simulations for the preceding study. Multiple simulations have shown very satisfying results, and the investigations demonstrate the efficacy and power-enhancing capabilities of the suggested control system.
Comparative analysis between traditional aquaponics and reconstructed aquapon...bijceesjournal
The aquaponic system of planting is a method that does not require soil usage. It is a method that only needs water, fish, lava rocks (a substitute for soil), and plants. Aquaponic systems are sustainable and environmentally friendly. Its use not only helps to plant in small spaces but also helps reduce artificial chemical use and minimizes excess water use, as aquaponics consumes 90% less water than soil-based gardening. The study applied a descriptive and experimental design to assess and compare conventional and reconstructed aquaponic methods for reproducing tomatoes. The researchers created an observation checklist to determine the significant factors of the study. The study aims to determine the significant difference between traditional aquaponics and reconstructed aquaponics systems propagating tomatoes in terms of height, weight, girth, and number of fruits. The reconstructed aquaponics system’s higher growth yield results in a much more nourished crop than the traditional aquaponics system. It is superior in its number of fruits, height, weight, and girth measurement. Moreover, the reconstructed aquaponics system is proven to eliminate all the hindrances present in the traditional aquaponics system, which are overcrowding of fish, algae growth, pest problems, contaminated water, and dead fish.
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...IJECEIAES
Medical image analysis has witnessed significant advancements with deep learning techniques. In the domain of brain tumor segmentation, the ability to
precisely delineate tumor boundaries from magnetic resonance imaging (MRI)
scans holds profound implications for diagnosis. This study presents an ensemble convolutional neural network (CNN) with transfer learning, integrating
the state-of-the-art Deeplabv3+ architecture with the ResNet18 backbone. The
model is rigorously trained and evaluated, exhibiting remarkable performance
metrics, including an impressive global accuracy of 99.286%, a high-class accuracy of 82.191%, a mean intersection over union (IoU) of 79.900%, a weighted
IoU of 98.620%, and a Boundary F1 (BF) score of 83.303%. Notably, a detailed comparative analysis with existing methods showcases the superiority of
our proposed model. These findings underscore the model’s competence in precise brain tumor localization, underscoring its potential to revolutionize medical
image analysis and enhance healthcare outcomes. This research paves the way
for future exploration and optimization of advanced CNN models in medical
imaging, emphasizing addressing false positives and resource efficiency.
artificial intelligence and data science contents.pptxGauravCar
What is artificial intelligence? Artificial intelligence is the ability of a computer or computer-controlled robot to perform tasks that are commonly associated with the intellectual processes characteristic of humans, such as the ability to reason.
› ...
Artificial intelligence (AI) | Definitio
Introduction- e - waste – definition - sources of e-waste– hazardous substances in e-waste - effects of e-waste on environment and human health- need for e-waste management– e-waste handling rules - waste minimization techniques for managing e-waste – recycling of e-waste - disposal treatment methods of e- waste – mechanism of extraction of precious metal from leaching solution-global Scenario of E-waste – E-waste in India- case studies.
Software Engineering and Project Management - Introduction, Modeling Concepts...Prakhyath Rai
Introduction, Modeling Concepts and Class Modeling: What is Object orientation? What is OO development? OO Themes; Evidence for usefulness of OO development; OO modeling history. Modeling
as Design technique: Modeling, abstraction, The Three models. Class Modeling: Object and Class Concept, Link and associations concepts, Generalization and Inheritance, A sample class model, Navigation of class models, and UML diagrams
Building the Analysis Models: Requirement Analysis, Analysis Model Approaches, Data modeling Concepts, Object Oriented Analysis, Scenario-Based Modeling, Flow-Oriented Modeling, class Based Modeling, Creating a Behavioral Model.
Software Engineering and Project Management - Introduction, Modeling Concepts...
IntroductionToCSharp.ppt
1. Introduction to C#
Mark Sapossnek
CS 594
Computer Science Department
Metropolitan College
Boston University
2. Prerequisites
This module assumes that you understand the
fundamentals of
Programming
Variables, statements, functions, loops, etc.
Object-oriented programming
Classes, inheritance, polymorphism,
members, etc.
C++ or Java
3. Learning Objectives
C# design goals
Fundamentals of the C# language
Types, program structure, statements, operators
Be able to begin writing and debugging C#
programs
Using the .NET Framework SDK
Using Visual Studio.NET
Be able to write individual C# methods
4. Agenda
Hello World
Design Goals of C#
Types
Program Structure
Statements
Operators
Using Visual Studio.NET
Using the .NET Framework SDK
5. Hello World
using System;
class Hello {
static void Main( ) {
Console.WriteLine("Hello world");
Console.ReadLine(); // Hit enter to finish
}
}
6. Agenda
Hello World
Design Goals of C#
Types
Program Structure
Statements
Operators
Using Visual Studio.NET
Using the .NET Framework SDK
7. Design Goals of C#
The Big Ideas
Component-orientation
Everything is an object
Robust and durable software
Preserving your investment
8. Design Goals of C#
Component-Orientation
C# is the first “Component-Oriented” language in
the C/C++ family
What is a component?
An independent module of reuse and deployment
Coarser-grained than objects
(objects are language-level constructs)
Includes multiple classes
Often language-independent
In general, component writer and user don’t know
each other, don’t work for the same company, and
don’t use the same language
9. Design Goals of C#
Component-Orientation
Component concepts are first class
Properties, methods, events
Design-time and run-time attributes
Integrated documentation using XML
Enables “one-stop programming”
No header files, IDL, etc.
Can be embedded in ASP pages
10. Design Goals of C#
Everything is an Object
Traditional views
C++, Java™: Primitive types are “magic” and do not
interoperate with objects
Smalltalk, Lisp: Primitive types are objects, but at
some performance cost
C# unifies with no performance cost
Deep simplicity throughout system
Improved extensibility and reusability
New primitive types: Decimal, SQL…
Collections, etc., work for all types
11. Design Goals of C#
Robust and Durable Software
Garbage collection
No memory leaks and stray pointers
Exceptions
Type-safety
No uninitialized variables, no unsafe casts
Versioning
Avoid common errors
E.g. if (x = y) ...
One-stop programming
Fewer moving parts
12. Design Goals of C#
Preserving Your Investment
C++ Heritage
Namespaces, pointers (in unsafe code),
unsigned types, etc.
Some changes, but no unnecessary sacrifices
Interoperability
What software is increasingly about
C# talks to XML, SOAP, COM, DLLs, and any
.NET Framework language
Increased productivity
Short learning curve
Millions of lines of C# code in .NET
13. Agenda
Hello World
Design Goals of C#
Types
Program Structure
Statements
Operators
Using Visual Studio.NET
Using the .NET Framework SDK
14. Types
Overview
A C# program is a collection of types
Classes, structs, enums, interfaces, delegates
C# provides a set of predefined types
E.g. int, byte, char, string, object, …
You can create your own types
All data and code is defined within
a type
No global variables, no global functions
15. Types
Overview
Types contain:
Data members
Fields, constants, arrays
Events
Function members
Methods, operators, constructors, destructors
Properties, indexers
Other types
Classes, structs, enums, interfaces, delegates
16. Types
Overview
Types can be instantiated…
…and then used: call methods,
get and set properties, etc.
Can convert from one type to another
Implicitly and explicitly
Types are organized
Namespaces, files, assemblies
There are two categories of types:
value and reference
Types are arranged in a hierarchy
17. Types
Unified Type System
Value types
Directly contain data
Cannot be null
Reference types
Contain references to objects
May be null
int i = 123;
string s = "Hello world";
123
i
s "Hello world"
18. Types
Unified Type System
Value types
Primitives int i; float x;
Enums enum State { Off, On }
Structs struct Point {int x,y;}
Reference types
Root object
String string
Classes class Foo: Bar, IFoo {...}
Interfaces interface IFoo: IBar {...}
Arrays string[] a = new string[10];
Delegates delegate void Empty();
19. Types
Unified Type System
Value (Struct) Reference (Class)
Variable holds Actual value Memory location
Allocated on Stack, member Heap
Nullability Always has value May be null
Default value 0 null
Aliasing (in a scope) No Yes
Assignment means Copy data Copy reference
20. Types
Unified Type System
Benefits of value types
No heap allocation, less GC pressure
More efficient use of memory
Less reference indirection
Unified type system
No primitive/object dichotomy
21. Types
Conversions
Implicit conversions
Occur automatically
Guaranteed to succeed
No information (precision) loss
Explicit conversions
Require a cast
May not succeed
Information (precision) might be lost
Both implicit and explicit conversions can be
user-defined
22. Types
Conversions
int x = 123456;
long y = x; // implicit
short z = (short)x; // explicit
double d = 1.2345678901234;
float f = (float)d; // explicit
long l = (long)d; // explicit
23. Types
Unified Type System
Everything is an object
All types ultimately inherit from object
Any piece of data can be stored, transported, and
manipulated with no extra work
MemoryStream FileStream
Stream Hashtable int double
object
24. Types
Unified Type System
Polymorphism
The ability to perform an operation on an object
without knowing the precise type of the object
void Poly(object o) {
Console.WriteLine(o.ToString());
}
Poly(42);
Poly(“abcd”);
Poly(12.345678901234m);
Poly(new Point(23,45));
25. Types
Unified Type System
Question: How can we treat value and reference
types polymorphically?
How does an int (value type) get converted into an
object (reference type)?
Answer: Boxing!
Only value types get boxed
Reference types do not get boxed
26. Types
Unified Type System
Boxing
Copies a value type into a reference type (object)
Each value type has corresponding “hidden”
reference type
Note that a reference-type copy is made of the
value type
Value types are never aliased
Value type is converted implicitly to object, a
reference type
Essentially an “up cast”
27. Types
Unified Type System
Unboxing
Inverse operation of boxing
Copies the value out of the box
Copies from reference type to value type
Requires an explicit conversion
May not succeed (like all explicit conversions)
Essentially a “down cast”
28. Types
Unified Type System
Boxing and unboxing
int i = 123;
object o = i;
int j = (int)o;
123
i
o
123
j
123
System.Int32
29. Types
Unified Type System
Benefits of boxing
Enables polymorphism across all types
Collection classes work with all types
Eliminates need for wrapper classes
Replaces OLE Automation's Variant
Lots of examples in .NET Framework
Hashtable t = new Hashtable();
t.Add(0, "zero");
t.Add(1, "one");
t.Add(2, "two");
string s = string.Format(
"Your total was {0} on {1}",
total, date);
30. Types
Unified Type System
Disadvantages of boxing
Performance cost
The need for boxing will decrease when the CLR
supports generics (similar to C++ templates)
32. Predefined Types
Value Types
All are predefined structs
Signed sbyte, short, int, long
Unsigned byte, ushort, uint, ulong
Character char
Floating point float, double, decimal
Logical bool
33. Predefined Types
Integral Types
C# Type System Type Size (bytes) Signed?
sbyte System.Sbyte 1 Yes
short System.Int16 2 Yes
int System.Int32 4 Yes
long System.Int64 8 Yes
byte System.Byte 1 No
ushort System.UInt16 2 No
uint System.UInt32 4 No
ulong System.UInt64 8 No
34. Predefined Types
Floating Point Types
Follows IEEE 754 specification
Supports ± 0, ± Infinity, NaN
C# Type System Type Size (bytes)
float System.Single 4
double System.Double 8
35. Predefined Types
decimal
128 bits
Essentially a 96 bit value scaled by a
power of 10
Decimal values represented precisely
Doesn’t support signed zeros, infinities
or NaN
C# Type System Type Size (bytes)
decimal System.Decimal 16
36. Predefined Types
decimal
All integer types can be implicitly converted to a
decimal type
Conversions between decimal and floating types
require explicit conversion due to possible loss
of precision
s * m * 10e
s = 1 or –1
0 m 296
-28 e 0
37. Predefined Types
Integral Literals
Integer literals can be expressed as decimal
or hexadecimal
U or u: uint or ulong
L or l: long or ulong
UL or ul: ulong
123 // Decimal
0x7B // Hexadecimal
123U // Unsigned
123ul // Unsigned long
123L // Long
38. Predefined Types
Real Literals
F or f: float
D or d: double
M or m: decimal
123f // Float
123D // Double
123.456m // Decimal
1.23e2f // Float
12.3E1M // Decimal
39. Predefined Types
bool
Represents logical values
Literal values are true and false
Cannot use 1 and 0 as boolean values
No standard conversion between other types
and bool
C# Type System Type Size (bytes)
bool System.Boolean 1 (2 for arrays)
40. Predefined Types
char
Represents a Unicode character
Literals
‘A’ // Simple character
‘u0041’ // Unicode
‘x0041’ // Unsigned short hexadecimal
‘n’ // Escape sequence character
C# Type System Type Size (bytes)
Char System.Char 2
41. Predefined Types
char
Escape sequence characters (partial list)
Char Meaning Value
’ Single quote 0x0027
” Double quote 0x0022
Backslash 0x005C
0 Null 0x0000
n New line 0x000A
r Carriage return 0x000D
t Tab 0x0009
43. Predefined Types
object
Root of object hierarchy
Storage (book keeping) overhead
0 bytes for value types
8 bytes for reference types
An actual reference (not the object)
uses 4 bytes
C# Type System Type Size (bytes)
object System.Object 0/8 overhead
44. Predefined Types
object Public Methods
public bool Equals(object)
protected void Finalize()
public int GetHashCode()
public System.Type GetType()
protected object MemberwiseClone()
public void Object()
public string ToString()
45. Predefined Types
string
An immutable sequence of Unicode characters
Reference type
Special syntax for literals
string s = “I am a string”;
C# Type System Type Size (bytes)
String System.String 20 minimum
46. Predefined Types
string
Normally have to use escape characters
Verbatim string literals
Most escape sequences ignored
Except for “”
Verbatim literals can be multi-line
string s1= “serverfilesharefilename.cs”;
string s2 = @“serverfilesharefilename.cs”;
47. Types
User-defined Types
User-defined types
Enumerations enum
Arrays int[], string[]
Interface interface
Reference type class
Value type struct
Function pointer delegate
48. Types
Enums
An enum defines a type name for a related
group of symbolic constants
Choices must be known at compile-time
Strongly typed
No implicit conversions to/from int
Can be explicitly converted
Operators: +, -, ++, --, &, |, ^, ~, …
Can specify underlying type
byte, sbyte, short, ushort, int, uint, long, ulong
49. Types
Enums
enum Color: byte {
Red = 1,
Green = 2,
Blue = 4,
Black = 0,
White = Red | Green | Blue
}
Color c = Color.Black;
Console.WriteLine(c); // 0
Console.WriteLine(c.Format()); // Black
50. Types
Enums
All enums derive from System.Enum
Provides methods to
determine underlying type
test if a value is supported
initialize from string constant
retrieve all values in enum
…
51. Types
Arrays
Arrays allow a group of elements of a specific
type to be stored in a contiguous block of
memory
Arrays are reference types
Derived from System.Array
Zero-based
Can be multidimensional
Arrays know their length(s) and rank
Bounds checking
52. Types
Arrays
Declare
Allocate
Initialize
Access and assign
Enumerate
int[] primes;
int[] primes = new int[9];
int[] prime = new int[] {1,2,3,5,7,11,13,17,19};
int[] prime = {1,2,3,5,7,11,13,17,19};
prime2[i] = prime[i];
foreach (int i in prime) Console.WriteLine(i);
53. Types
Arrays
Multidimensional arrays
Rectangular
int[,] matR = new int[2,3];
Can initialize declaratively
int[,] matR =
new int[2,3] { {1,2,3}, {4,5,6} };
Jagged
An array of arrays
int[][] matJ = new int[2][];
Must initialize procedurally
54. Types
Interfaces
An interface defines a contract
Includes methods, properties, indexers, events
Any class or struct implementing an interface must
support all parts of the contract
Interfaces provide polymorphism
Many classes and structs may implement
a particular interface
Contain no implementation
Must be implemented by a class or struct
56. Types
Classes
Members
Constants, fields, methods, operators,
constructors, destructors
Properties, indexers, events
Static and instance members
Member access
public, protected, private, internal,
protected internal
Default is private
Instantiated with new operator
57. Types
Structs
Similar to classes, but
User-defined value type
Always inherits from object
Ideal for lightweight objects
int, float, double, etc., are all structs
User-defined “primitive” types
Complex, point, rectangle, color, rational
Multiple interface inheritance
Same members as class
Member access
public, internal, private
Instantiated with new operator
58. Types
Classes and Structs
struct SPoint { int x, y; ... }
class CPoint { int x, y; ... }
SPoint sp = new SPoint(10, 20);
CPoint cp = new CPoint(10, 20);
10
20
sp
cp
10
20
CPoint
59. Types
Delegates
A delegate is a reference type that defines a
method signature
When instantiated, a delegate holds one or more
methods
Essentially an object-oriented function pointer
Foundation for framework events
60. Agenda
Hello World
Design Goals of C#
Types
Program Structure
Statements
Operators
Using Visual Studio.NET
Using the .NET Framework SDK
62. Program Structure
Organizing Types
Physical organization
Types are defined in files
Files are compiled into
modules
Modules are grouped
into assemblies
Assembly
Module
File
Type
63. Program Structure
Organizing Types
Types are defined in files
A file can contain multiple types
Each type is defined in a single file
Files are compiled into modules
Module is a DLL or EXE
A module can contain multiple files
Modules are grouped into assemblies
Assembly can contain multiple modules
Assemblies and modules are often 1:1
64. Program Structure
Organizing Types
Types are defined in ONE place
“One-stop programming”
No header and source files to synchronize
Code is written “in-line”
Declaration and definition are one and
the same
A type must be fully defined in one file
Can’t put individual methods in different files
No declaration order dependence
No forward references required
65. Program Structure
Namespaces
Namespaces provide a way to
uniquely identify a type
Provides logical organization of types
Namespaces can span assemblies
Can nest namespaces
There is no relationship between namespaces
and file structure (unlike Java)
The fully qualified name of a type includes all
namespaces
67. Program Structure
Namespaces
The using statement lets you use types without
typing the fully qualified name
Can always use a fully qualified name
using N1;
C1 a; // The N1. is implicit
N1.C1 b; // Fully qualified name
C2 c; // Error! C2 is undefined
N1.N2.C2 d; // One of the C2 classes
C1.C2 e; // The other one
68. Program Structure
Namespaces
The using statement also lets you create
aliases
using C1 = N1.N2.C1;
using N2 = N1.N2;
C1 a; // Refers to N1.N2.C1
N2.C1 b; // Refers to N1.N2.C1
69. Program Structure
Namespaces
Best practice: Put all of your types in a unique
namespace
Have a namespace for your company, project,
product, etc.
Look at how the .NET Framework classes are
organized
70. Program Structure
References
In Visual Studio you specify references
for a project
Each reference identifies a specific assembly
Passed as reference (/r or /reference)
to the C# compiler
csc HelloWorld.cs /reference:System.WinForms.dll
71. Program Structure
Namespaces vs. References
Namespaces provide language-level naming
shortcuts
Don’t have to type a long fully qualified name over
and over
References specify which assembly to use
72. Program Structure
Main Method
Execution begins at the static Main() method
Can have only one method with one of
the following signatures in an assembly
static void Main()
static int Main()
static void Main(string[] args)
static int Main(string[] args)
73. Program Structure
Syntax
Identifiers
Names for types, methods, fields, etc.
Must be whole word – no white space
Unicode characters
Begins with letter or underscore
Case sensitive
Must not clash with keyword
Unless prefixed with @
74. Agenda
Hello World
Design Goals of C#
Types
Program Structure
Statements
Operators
Using Visual Studio.NET
Using the .NET Framework SDK
75. Statements
Overview
High C++ fidelity
if, while, do require bool condition
goto can’t jump into blocks
switch statement
No fall-through
foreach statement
checked and unchecked statements
Expression
statements
must do work
void Foo() {
i == 1; // error
}
79. Statements
Statement Lists & Block Statements
Statement list: one or more statements in
sequence
Block statement: a statement list delimited by
braces { ... }
static void Main() {
F();
G();
{ // Start block
H();
; // Empty statement
I();
} // End block
}
80. Statements
Variables and Constants
static void Main() {
const float pi = 3.14f;
const int r = 123;
Console.WriteLine(pi * r * r);
int a;
int b = 2, c = 3;
a = 1;
Console.WriteLine(a + b + c);
}
82. Statements
Variables and Constants
Within the scope of a variable or constant it is an
error to declare another variable or constant with
the same name
{
int x;
{
int x; // Error: can’t hide variable x
}
}
83. Statements
Variables
Variables must be assigned a value before they
can be used
Explicitly or automatically
Called definite assignment
Automatic assignment occurs for static fields,
class instance fields and array elements
void Foo() {
string s;
Console.WriteLine(s); // Error
}
84. Statements
Labeled Statements & goto
goto can be used to transfer control within or
out of a block, but not into a nested block
static void Find(int value, int[,] values,
out int row, out int col) {
int i, j;
for (i = 0; i < values.GetLength(0); i++)
for (j = 0; j < values.GetLength(1); j++)
if (values[i, j] == value) goto found;
throw new InvalidOperationException(“Not found");
found:
row = i; col = j;
}
85. Statements
Expression Statements
Statements must do work
Assignment, method call, ++, --, new
static void Main() {
int a, b = 2, c = 3;
a = b + c;
a++;
MyClass.Foo(a,b,c);
Console.WriteLine(a + b + c);
a == 2; // ERROR!
}
86. Statements
if Statement
Requires bool expression
int Test(int a, int b) {
if (a > b)
return 1;
else if (a < b)
return -1;
else
return 0;
}
87. Statements
switch Statement
Can branch on any predefined type
(including string) or enum
User-defined types can provide implicit conversion
to these types
Must explicitly state how to end case
With break, goto case, goto label, return,
throw or continue
Eliminates fall-through bugs
Not needed if no code supplied after the label
88. Statements
switch Statement
int Test(string label) {
int result;
switch(label) {
case null:
goto case “runner-up”;
case “fastest”:
case “winner”:
result = 1; break;
case “runner-up”:
result = 2; break;
default:
result = 0;
}
return result;
}
89. Statements
while Statement
Requires bool expression
int i = 0;
while (i < 5) {
...
i++;
}
int i = 0;
do {
...
i++;
}
while (i < 5); while (true) {
...
}
92. Statements
foreach Statement
Iteration of user-defined collections
Created by implementing IEnumerable
foreach (Customer c in customers.OrderBy("name")) {
if (c.Orders.Count != 0) {
...
}
}
93. Statements
Jump Statements
break
Exit inner-most loop
continue
End iteration of inner-most loop
goto <label>
Transfer execution to label statement
return [<expression>]
Exit a method
throw
See exception handling
94. Statements
Exception Handling
Exceptions are the C# mechanism for handling
unexpected error conditions
Superior to returning status values
Can’t be ignored
Don’t have to handled at the point they occur
Can be used even where values are not returned
(e.g. accessing a property)
Standard exceptions are provided
95. Statements
Exception Handling
try...catch...finally statement
try block contains code that could throw an
exception
catch block handles exceptions
Can have multiple catch blocks to handle different
kinds of exceptions
finally block contains code that will always be
executed
Cannot use jump statements (e.g. goto)
to exit a finally block
96. Statements
Exception Handling
throw statement raises an exception
An exception is represented as an instance of
System.Exception or derived class
Contains information about the exception
Properties
Message
StackTrace
InnerException
You can rethrow an exception, or catch
one exception and throw another
98. Statements
Synchronization
Multi-threaded applications have to protect
against concurrent access to data
Must prevent data corruption
The lock statement uses an instance to provide
mutual exclusion
Only one lock statement can have access to the
same instance
Actually uses the .NET Framework
System.Threading.Monitor class to
provide mutual exclusion
99. Statements
Synchronization
public class CheckingAccount {
decimal balance;
public void Deposit(decimal amount) {
lock (this) {
balance += amount;
}
}
public void Withdraw(decimal amount) {
lock (this) {
balance -= amount;
}
}
}
100. Statements
using Statement
C# uses automatic memory management
(garbage collection)
Eliminates most memory management problems
However, it results in non-deterministic
finalization
No guarantee as to when and if object destructors
are called
101. Statements
using Statement
Objects that need to be cleaned up after use
should implement the System.IDisposable
interface
One method: Dispose()
The using statement allows you to create an
instance, use it, and then ensure that Dispose
is called when done
Dispose is guaranteed to be called, as if it were in a
finally block
102. Statements
using Statement
public class MyResource : IDisposable {
public void MyResource() {
// Acquire valuble resource
}
public void Dispose() {
// Release valuble resource
}
public void DoSomething() {
...
}
} using (MyResource r = new MyResource()) {
r.DoSomething();
} // r.Dispose() is called
103. Statements
checked and unchecked Statements
The checked and unchecked statements allow
you to control overflow checking for integral-type
arithmetic operations and conversions
checked forces checking
unchecked forces no checking
Can use both as block statements or
as an expression
Default is unchecked
Use the /checked compiler option to make
checked the default
104. Statements
Basic Input/Output Statements
Console applications
System.Console.WriteLine();
System.Console.ReadLine();
Windows applications
System.WinForms.MessageBox.Show();
string v1 = “some value”;
MyObject v2 = new MyObject();
Console.WriteLine(“First is {0}, second is {1}”,
v1, v2);
105. Agenda
Hello World
Design Goals of C#
Types
Program Structure
Statements
Operators
Using Visual Studio.NET
Using the .NET Framework SDK
106. Operators
Overview
C# provides a fixed set of operators, whose
meaning is defined for the predefined types
Some operators can be overloaded (e.g. +)
The following table summarizes the C#
operators by category
Categories are in order of decreasing precedence
Operators in each category have the same
precedence
109. Operators
Precedence
Category Operators
Additive
Add: +
Subtract: -
Shift
Shift bits left: <<
Shift bits right: >>
Relational
Less than: <
Greater than: >
Less than or equal to: <=
Greater than or equal to: >=
Type equality/compatibility: is
Type conversion: as
112. Operators
Associativity
Assignment and ternary conditional operators
are right-associative
Operations performed right to left
x = y = z evaluates as x = (y = z)
All other binary operators are left-associative
Operations performed left to right
x + y + z evaluates as (x + y) + z
Use parentheses to control order
113. Agenda
Hello World
Design Goals of C#
Types
Program Structure
Statements
Operators
Using Visual Studio.NET
Using the .NET Framework SDK
114. Using Visual Studio.NET
Types of projects
Console Application
Windows Application
Web Application
Web Service
Windows Service
Class Library
...
115. Using Visual Studio.NET
Windows
Solution Explorer
Class View
Properties
Output
Task List
Object Browser
Server Explorer
Toolbox
117. Agenda
Hello World
Design Goals of C#
Types
Program Structure
Statements
Operators
Using Visual Studio.NET
Using the .NET Framework SDK
118. Using .NET Framework SDK
Compiling from command line
csc /r:System.WinForms.dll class1.cs file1.cs