Seven Things about C#

A beginners tutorial, where each article highlights 7 important things about a specific feature of the C# programming language.

Member-only story

7 Things about C#: Types

--

Bright shapes of different types
C# has objects of different types and shapes

A type is a name given to some container that holds data of a specific size and shape. e.g. an int is a type that holds an integer number, a char is a type that holds a symbolic character, and a Recipe might be a complex type that holds ingredients and instructions.

With the C# type system, the big win for you is in productivity for your coding experience. C# is referred to as a strongly typed or type safe language. This means that you can only assign a value to a compatibly typed variable. It’s productive because the compiler catches type safety violations as soon as you build the app. That way, you can find and fix an entire category of errors in your app right away. The alternative would be to not find those errors and need to deal with them some time in the future where those errors might be even more problematic, difficult to detect, and expensive to correct.

Note: On type safety, the C# compiler will emit an error and not compile the app on type errors. e.g. trying to assign incompatible types, like a string to an int. These are called compile-time errors. Another type of error that can occur is a run-time error that the compiler wasn’t able to detect, which occurs when the application is running.

1 — There are several built-in types

--

--

Seven Things about C#
Seven Things about C#

Published in Seven Things about C#

A beginners tutorial, where each article highlights 7 important things about a specific feature of the C# programming language.

Joe Mayo
Joe Mayo

Written by Joe Mayo

Author, Instructor, & Independent Consultant. Author of C# Cookbook: — http://bit.ly/CSharpCookbook — @OReillyMedia #ai #csharp #Web3

No responses yet