FlashKeepers

C# · College · College and University

C# I: Syntax and Types

C# value and reference types, nullable types, strings, control flow, methods, arrays and the .NET type system.

About this set

39 basic cards for College C#. It opens with "What is a value type in C#?" and "Where are value types stored in memory?". Study it alongside the other College sets below.

39 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What is a value type in C#?
Show answerA type whose instances are stored directly on the stack and contain their actual data.
Where are value types stored in memory?
Show answerOn the stack.
What is boxing in C#?
Show answerConverting a value type to an object reference type, allocating it on the heap.
What is unboxing in C#?
Show answerExtracting a value type from a boxed object, converting it back to its value form.
What does struct keyword declare?
Show answerA value type that can contain methods, properties, and fields.
What is the main difference between struct and class?
Show answerStruct is a value type (stack), class is a reference type (heap).
Name three built-in value types in C#.
Show answerint, double, bool (or byte, decimal, char, long, etc.)
Do value type fields have default values?
Show answerYes, all fields are initialized to their default value (0, false, etc.) automatically.
What is a reference type in C#?
Show answerA type whose instances store a reference to data on the heap, not the data itself.
Where are reference types stored in memory?
Show answerOn the heap, with a reference stored on the stack.
What does class keyword declare?
Show answerA reference type that can contain methods, properties, fields, and other members.
What is the difference between passing by value and by reference?
Show answerBy value: a copy is passed; by reference: the original variable is passed and changes reflect outside.
What does the new keyword do?
Show answerAllocates memory on the heap and calls a constructor for a reference type.
What is null in C#?
Show answerA special value indicating a reference type variable does not point to any object.
What is the syntax for a nullable type?
Show answerType followed by a question mark, e.g. int?, double?, string?

24 more cards in the app

Study this set free