This document provides an overview of basic C# programming concepts. It covers topics such as program structure, data types, variables, operators, decision making statements, loops, classes and methods. Specifically, it discusses if/else statements, switch cases, ternary operators, for, while and do-while loops. It also provides examples of basic C# programs and explanations of concepts like classes, methods, constructors and namespaces.
This presentation comes with many additional notes (pdf): http://de.slideshare.net/nicolayludwig/2-c-sharp-introductionbasicsparti-38639098
- A Tour through other .Net Programming Languages
- C# Syntax Cornerstones
Complete Information till 2D arrays. In this slides you can also find information about loops and control decision....
Best slides for beginners who wants to learn about C programming language..
Logical Expressions in C/C++. Mistakes Made by ProfessionalsPVS-Studio
In programming, a logical expression is a language construct that is evaluated as true or false. Many books that teach programming "from scratch" discuss possible operations on logical expressions familiar to every beginner. In this article, I won't be talking about the AND operator having higher precedence than OR. Instead, I will talk about common mistakes that programmers make in simple conditional expressions consisting of no more than three operators, and show how you can check your code using truth tables. Mistakes described here are the ones made by the developers of such well-known projects as FreeBSD, Microsoft ChakraCore, Mozilla Thunderbird, LibreOffice, and many others.
This presentation comes with many additional notes (pdf): http://de.slideshare.net/nicolayludwig/2-c-sharp-introductionbasicsparti-38639098
- A Tour through other .Net Programming Languages
- C# Syntax Cornerstones
Complete Information till 2D arrays. In this slides you can also find information about loops and control decision....
Best slides for beginners who wants to learn about C programming language..
Logical Expressions in C/C++. Mistakes Made by ProfessionalsPVS-Studio
In programming, a logical expression is a language construct that is evaluated as true or false. Many books that teach programming "from scratch" discuss possible operations on logical expressions familiar to every beginner. In this article, I won't be talking about the AND operator having higher precedence than OR. Instead, I will talk about common mistakes that programmers make in simple conditional expressions consisting of no more than three operators, and show how you can check your code using truth tables. Mistakes described here are the ones made by the developers of such well-known projects as FreeBSD, Microsoft ChakraCore, Mozilla Thunderbird, LibreOffice, and many others.
We are an IT Company that's develop website,software,android,iPhone application as well as provide professional training in different course like php training, android training, iPhone training, .net training in Gandhinagar.
C# is a object oriented programming language as well as modern programming Language. It is nothing but extension of C++. Its a simple and general purpose programming language for application development.
This is a little presentation for those interested in learning C#. I find it useful to present this to new clients to see where they are at in the the programming curve.
Programming language model organized around objects rather than "actions" and data rather than “logic”. For a programming language to be a true OOP language, the language must meet the following criteria: abstraction, encapsulation, polymorphism, inheritance
We will study in depth, the Arduino program structure and we will learn more new terminologies used in the Arduino world. The Arduino software is open-source.
03. Operators Expressions and statementsIntro C# Book
In this chapter we will get acquainted with the operators in C# and the actions they can perform on the different data types. We will explain the priorities of the operators and we will analyze the different types of operators, according to the count of the arguments they can take and the actions they can perform. In the second part we will examine the conversion of data types. We will explain when and why it is needed to be done and how to work with different data types. At the end of the chapter we will pay special attention to the expressions and how we should work with them.
#Code2Create series: C++ is a powerful general-purpose programming language. It can be used to develop operating systems, browsers, games, and so on. C++ supports different ways of programming like procedural, object-oriented, functional, and so on.Start your programming journey and join us to learn C++ basics!
by Google Developers Group and Women Tech-markers Kuwait chapter:
Instagram and Twitter: @GDGWTMKUWAIT
03 and 04 .Operators, Expressions, working with the console and conditional s...Intro C# Book
In this chapter we will get acquainted with the operators in Java and the actions they can perform on the different data types. We will explain the priorities of the operators and we will analyze the different types of operators, according to the count of the arguments they can take and the actions they can perform. In the second part we will examine the conversion of data types.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails. How to prevent this and what approach to choose? I have launched dozens of complex projects and during the talk we will analyze which approaches have worked for me and which have not.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
2. Contents
Introduction to C#
Programing Structure of C#
Create First Program using Console Application
Class
Data types and Variable Declaration
Operators
Decision making Statements
if,if else, if elseif,nested if
Switch Case
? : (Ternary Operator)
Loops
for
while
do while
Foreach
3. Introduction to C#
Language Created by Anders Hejlsberg (father of
Delphi)
The Derivation History can be viewed here:
http://www.levenez.com/lang/history.html
Principle Influencing Languages:
C++
Delphi
Java
C# Designed to be an optimal Windows
development language
5. C#- The Big Ideas
C# is the first “component oriented” language in the
C/C++ family
Class
Properties
Methods
Events
OOPs
6. Robust and durable software
Garbage collection
No memory leaks and stray pointers
Exceptions
Error handling is not an afterthought
Type-safety
No uninitialized variables, unsafe casts
Versioning
Pervasive versioning considerations in all aspects of language
design
Namespace (Packages in Java)
7.
8. Its worth to note
C# is case sensitive.
All statements and expression must end with a
semicolon (;).
The program execution starts at the Main method.
Unlike Java, file name could be different from the
class name.
9. Class,Memebers and Methods
Everything is encapsulated in a class
Can have:
member data
member methods
Class clsName
{
modifier dataType varName;
modifier returnType methodName (params)
{
statements;
return returnVal;
}
}
11. Single inheritance
Multiple interface implementation
Class members
Constants, fields, methods, properties, indexers, events,
operators, constructors, destructors
Static and instance members
Nested types
Member access
public, protected, internal, private
12. Hello World
using System;
namespace Sample
{
//Class
public class HelloWorld
{
public HelloWorld()
{
Constructor
}
//Main method
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
/* Comments in C#
}
}
}
13. Compile & Execute a C# Program
If you are using Visual Studio.Net for compiling and executing C#
programs, take the following steps:
Start Visual Studio.
On the menu bar, choose File, New, Project.
Choose Visual C# from templates, and then choose Windows.
Choose Console Application.
Specify a name for your project, and then choose the OK button.
The new project appears in Solution Explorer.
Write code in the Code Editor.
Click the Run button or the F5 key to run the project. A Command
Prompt window appears that contains the line Hello World.
14. Data types and Variable Declaration
Value types
Directly contain data
Cannot be null
Reference types
Contain references to objects
May be null
int i = 123;
string s = "Hello world";
123i
s "Hello world"
15. Type System
Value types
Primitives int i;
Enums enum State { Off, On }
Structs struct Point { int x, y; }
Reference types
Classes class Foo: Bar, IFoo {...}
Interfaces interface IFoo: IBar {...}
Arrays string[] a = new string[10];
Delegates delegate void Empty();
16. Structure
Like classes, except
Stored in-line, not heap allocated
Assignment copies data, not reference
No inheritance
Ideal for light weight objects
Complex, point, rectangle, color
int, float, double, etc., are all structs
Benefits
No heap allocation, less GC pressure
More efficient use of memory
17. Predefined Types
C# predefined types
Reference object, string
Signed sbyte, short, int, long
Unsigned byte, ushort, uint, ulong
Character char
Floating-point float, double, decimal
Logical bool
Predefined types are simply aliases for system-
provided types
For example, int == System.Int32
18. Reserved Keywords
abstract as base Bool break byte case
catch char checked Class const continue decimal
default delegate do double else enum event
explicit extern false finally fixed float for
foreach goto if implicit in in (generic
modifier)
int
interface internal is lock long namespace new
null object operator out out
(generic
modifier)
override params
private protected public readonly ref return sbyte
sealed short sizeof stackalloc static string struct
switch this throw true try typeof uint
ulong unchecked unsafe ushort using virtual void
volatile
add alias ascending descending dynamic from get
global group into join let orderby partial
(type)
partial
(method)
remove select set
19. Using System // Namespace
class Rectangle
{
// member variables declaration
double length;
double width;
//Method
public void Acceptdetails()
{
length = 10.5; //Assign values to variable
width = 6.5;
}
public double GetArea()
{
return length * width;
}
public void Display()
{
Console.WriteLine("Length: {0}", length);
Console.WriteLine("Width: {0}", width);
Console.WriteLine("Area: {0}", GetArea());
}
}//End class Rectangle
class ExecuteRectangle
{
static void Main(string[] args)
{
Rectangle objRec = new Rectangle(); //Create Object of Class
objRec.Acceptdetails();// Call method
objRec.Display();
Console.ReadLine();
}
}
21. Arithmetic operators
Operator Description Example
+ Adds two operands A + B will give 30
- Subtracts second operand from the first A - B will give -10
* Multiplies both operands A * B will give 200
/ Divides numerator by de-numerator B / A will give 2
% Modulus Operator and remainder of after an integer division B % A will give 0
++ Increment operator increases integer value by one A++ will give 11
-- Decrement operator decreases integer value by one A-- will give 9
22. Relational Operator
Operator Description Example
== Checks if the values of two operands are equal or
not, if yes then condition becomes true.
(A == B) is not true.
!= Checks if the values of two operands are equal or
not, if values are not equal then condition
becomes true.
(A != B) is true.
> Checks if the value of left operand is greater
than the value of right operand, if yes then
condition becomes true.
(A > B) is not true.
< Checks if the value of left operand is less than
the value of right operand, if yes then condition
becomes true.
(A < B) is true.
>= Checks if the value of left operand is greater
than or equal to the value of right operand, if yes
then condition becomes true.
(A >= B) is not true.
<= Checks if the value of left operand is less than or
equal to the value of right operand, if yes then
condition becomes true.
(A <= B) is true.
23. Logical operators
Operato
r
Description Example
&& Called Logical AND operator. If both the operands are
non zero then condition becomes true.
(A && B) is false.
|| Called Logical OR Operator. If any of the two operands
is non zero then condition becomes true.
(A || B) is true.
! Called Logical NOT Operator. Use to reverses the
logical state of its operand. If a condition is true then
Logical NOT operator will make false.
!(A && B) is true.
24. Bitwise Operators
Operator Description Example
&
Binary AND Operator copies a bit to the
result if it exists in both operands.
(A & B) will give 12. which is 0000 1100
|
Binary OR Operator copies a bit if it exists
in either operand.
(A | B) will give 61, which is 0011 1101
^
Binary XOR Operator copies the bit if it is
set in one operand but not both.
(A ^ B) will give 49, which is 0011 0001
~
Binary Ones Complement Operator is
unary and has the effect of 'flipping' bits.
(~A ) will give -61, which is 1100 0011 in 2's
complement due to a signed binary number.
<<
Binary Left Shift Operator. The left
operands value is moved left by the
number of bits specified by the right
operand.
A << 2 will give 240, which is 1111 0000
>>
Binary Right Shift Operator. The left
operands value is moved right by the
number of bits specified by the right
operand.
A >> 2 will give 15, which is 0000 1111
25. Assignment Operators
Operat
or
Description Example
=
Simple assignment operator, Assigns values from right side operands to left side
operand
C = A + B will assign
value of A + B into C
+=
Add AND assignment operator, It adds right operand to the left operand and assign
the result to left operand
C += A is equivalent
to C = C + A
-=
Subtract AND assignment operator, It subtracts right operand from the left operand
and assign the result to left operand
C -= A is equivalent
to C = C - A
*=
Multiply AND assignment operator, It multiplies right operand with the left operand
and assign the result to left operand
C *= A is equivalent
to C = C * A
/=
Divide AND assignment operator, It divides left operand with the right operand and
assign the result to left operand
C /= A is equivalent
to C = C / A
%=
Modulus AND assignment operator, It takes modulus using two operands and assign
the result to left operand
C %= A is equivalent
to C = C % A
<<= Left shift AND assignment operator
C <<= 2 is same as C
= C << 2
>>= Right shift AND assignment operator
C >>= 2 is same as C
= C >> 2
&= Bitwise AND assignment operator
C &= 2 is same as C
= C & 2
^= bitwise exclusive OR and assignment operator
C ^= 2 is same as C
= C ^ 2
|= bitwise inclusive OR and assignment operator
C |= 2 is same as C =
C | 2
26. Operator Description Example
sizeof() Returns the size of a data type. sizeof(int), will return 4.
typeof() Returns the type of a class. typeof(StreamReader);
& Returns the address of an variable. &a; will give actual address of
the variable.
Other Operator
27. Operators Precedence in C#
Category Operator Associativity
Postfix () [] -> . ++ - - Left to right
Unary + - ! ~ ++ - - (type)* & sizeof Right to left
Multiplicative * / % Left to right
Additive + - Left to right
Shift << >> Left to right
Relational < <= > >= Left to right
Equality == != Left to right
Bitwise AND & Left to right
Bitwise XOR ^ Left to right
Bitwise OR | Left to right
Logical AND && Left to right
Logical OR || Left to right
Conditional ?: Right to left
Assignment
= += -= *= /= %=>>= <<= &=
^= |=
Right to left
Comma , Left to right
28. Decision Making using C#
Decision making structures require that the programmer
specify one or more conditions to be evaluated or tested
by the program, along with a statement(s) to be executed
if the condition is determined to be true, and optionally,
other statements to be executed if the condition is
determined to be false.
Statements
If {…}
If { …} else {…}
If {….} else if{…}
Nested if statements
Switch () case :
Ternary operator ( ?: )
29. If Statement
An if statement consists of a boolean expression
followed by one or more statements.
If(boolean_expression)
{
/* statement(s) will execute if the boolean expression
is true */
}
30. If …else
• An if statement can be followed by an optional else
statement, which executes when the boolean expression is
false
if(boolean_expression)
{
/* statement(s) will execute if the boolean expression is true */
}
else
{
/* statement(s) will execute if the boolean expression is false */
}
31. Nested IF
• You can use one if or else if statement inside
another if or else if statement(s).
if( boolean_expression 1)
{
/* Executes when the boolean expression 1 is true */
if(boolean_expression 2)
{
/* Executes when the boolean expression 2 is true */
}
}
32. Nested IF Example
class Program
{
static void Main()
{
SampleMethod1(50);
SampleMethod2(50);
SampleMethod3(50);
}
void SampleMethod1(int value)
{
if (value >= 10)
{
if (value <= 100)
{
Console.WriteLine(true);
}
}
}
void SampleMethod2(int value)
{
if (value >= 10 &&
value <= 100)
{
Console.WriteLine(true);
}
}
void SampleMethod3(int value)
{
if (value <= 100 &&
value >= 10)
{
Console.WriteLine(true);
}
}
}
33. Switch Case
A switch statement allows a variable to be tested for equality against a list of
values. Each value is called a case, and the variable being switched on is checked for
each switch case.
switch(ch1)
{
case 'A':
printf("This A is part of outer switch" );
switch(ch2)
{
case 'A':
printf("This A is part of inner switch" );
break;
case 'B': /* inner B case code */
}
break;
case 'B': /* outer B case code */
}
34. class SwitchTest
{
static void Main()
{
Console.WriteLine("Coffee sizes: 1=small 2=medium 3=large");
Console.Write("Please enter your selection: ");
string str = Console.ReadLine();
int cost = 0;
// Notice the goto statements in cases 2 and 3. The base cost of 25
// cents is added to the additional cost for the medium and large sizes.
switch (str)
{
case "1":
case "small":
cost += 25;
break;
case "2":
case "medium":
cost += 25;
goto case "1";
case "3":
case "large":
cost += 50;
goto case "1";
default:
Console.WriteLine("Invalid selection. Please select 1, 2, or 3.");
break;
}
if (cost != 0)
{
Console.WriteLine("Please insert {0} cents.", cost);
}
Console.WriteLine("Thank you for your business.");
}
}
Switch Case Example
35. The ? : Operator
We have covered conditional operator ? : in
previous chapter which can be used to
replace if...elsestatements. It has the following
general form:
Exp1 ? Exp2 : Exp3;
Where Exp1, Exp2, and Exp3 are expressions. Notice
the use and placement of the colon.
36. Loops
A loop statement allows us to execute a statement or
group of statements multiple times and following is
the general from of a loop statement in most of the
programming languages:
For(…) {};
While() {}
Do{…}While(…);
forEach(…)
37. For Loop
For loop
For loop is a repetition control structure that allows
you to efficiently write a loop that needs to execute a
specific number of times.
for ( init; condition; increment/Decreament )
{
statement(s);
}
38. Basic example of for loop
class Program
{
static void Main(string[] args)
{
/* for loop execution */
for (int a = 10; a < 20; a = a + 1)
{
Console.WriteLine("value of a: {0}", a);
}
Console.ReadLine();
}
}
39. While loop
Repeats a statement or group of statements while a
given condition is true. It tests the condition before
executing the loop body.
while(condition)
{
statement(s);
}
40. Example of While
class WhileTest
{
static void Main()
{
int n = 2;
while (n < 20)
{
Console.WriteLine("Current value of n is {0}", n);
n+=2;
}
}
}
41. Do While
Like a while statement, except that it tests the
condition at the end of the loop body
do
{
statement(s);
}while( condition );
42. Do While Example
public class TestDoWhile
{
public static void Main ()
{
int x = 2;
do
{
Console.WriteLine(x);
x+=2;
} while (x < 20);
}
}
43. foreach
The foreach statement is used to iterate through the
collection to get the information that you want
Does not use integer index
Can be use for Array,Collection , List,Class Collection
Returns each element in order
foreach (CollectionElementType name in Collection)
{
}
44. ForEach example
class Program
{
static void Main(string[] args)
{
string[] arr = new string[5]; // declaring array
//Storing value in array element
arr[0] = “C#";
arr[1] = “C";
arr[2] = “C++";
arr[3] = “JAVA";
arr[4] = “Android";
//retrieving value using foreach loop
foreach (string name in arr)
{
Console.WriteLine(“Working on" + name);
}
Console.ReadLine();
}
}