Zebra0.com
Functions in C#
Privacy
Contact
Topics
Algorithms
Alice 3
C++
C# Windows
RGB Colors
Computer Basics
Computer Concepts
HTML5
K12: Resources for Parents
Fidget Quilts
Functions in C#
Learn C# (C sharp) in FREE step-by-step lessons.
Module 06: Functions in C#
C# has a number of builtin functions.
This lesson includes some of the most commonly used functions.
Goals:
Learn about Built-in functions in C#, Math functions, Parsing, Random numbers
Objectives:
Be able to use built in functions in C#;
Be able to use the math functions to solve a problem;
Be able to parse a string and convert to double;
Understand and be able to use random numbers.
Please study the material at each of the links below.
Microsoft Reference
:
C# Math Functions
Math Functions
:
C# has a number of built-in functions and constants that you can use.
Demonstration of Math Functions
:
Shows how math functions might be used
Drill on Math Functions Ceiling, Floor, and Round
:
Check your understanding of these functions
ToString function instead of + to concatenate
:
Compares using + and ToString()
Parse: Convert text to Double
:
A user does not always type a numeric value in text box, parse to get numeric value
TryParse: Convert text to Double if Numeric
:
TryParse to handle numeric error
Ceiling: How many busses?
:
Real world problem to solve
Random Numbers
:
Code to declare and use a random number
Circle: Write a function to find area
:
A function receives the radius and returns the area
A Function to Generate Random Colors
:
A function to return a random color using Color.FromArgb(red, green, blue);
BMI: A Void Function to calculate Body Mass Index
:
A void function does not return a value
Glossary for functions lesson
Full Glossary