Related Articles

Back to Latest Articles

C# Basics – Random Numbers, Chars and Strings – Part 7

We introduce data types like strings and chars in C# programming language

Andraz Krzisnik
C# Basics – Random Numbers, Chars and...

Random Numbers

To generate a random number, we will use a constructor called Random. Then to generate a random number we will use either .Next() or .NextDouble() function.

Char Data Type

We can store a value to a variable that is just a single symbol by itself. These type of variables are called char – short for character. We can store symbols such as lowercase letters, uppercase letters, all numerals, special symbols like dot or comma and many more. When declaring a char it is important to write with single quotes (Example: ‘a’).


Strings are very useful data type, because we almost always work with strings when we work with data that is not numerical. For example names and addresses. But they are useful for more than just that.

How do we declare a string?

It’s important that you put any kind of string value between double quotes.

We can also access each letter in a string like we would access values in an array. So string is an array of each individual characters.

Download Examples Next Chapter
Show Comments (2)


  • furtdsolinopv

    We’re a group of volunteers and starting a new scheme in our community. Your website provided us with valuable information to work on. You’ve done a formidable job and our entire community will be thankful to you.

    • Article Author
    • Reply
  • Cuckold Cams

    This piece of writing gives clear idea for the new visitors of blogging, that genuinely how to do blogging and site-building.

    • Article Author
    • Reply

Related Articles

C# Basics

C# Basics – Conditional Statements – Part 5

Conditional Statements There is a data type for logic operations, called bool. Possible values that this kind of variable can hold are true and false. Let’s take a look at logic...

Posted on by Andraz Krzisnik
C# Tutorial

C# Tutorial: How To Apply Sobel Operator To An Image

What is sobel operator? Well, basically it’s 2 kernels, with which we can process an image in a way, that only edges are visible. It is commonly used for grayscale images,...

Posted on by Andraz Krzisnik