Data types in c#

Data types in c#

Datatype specifies the different sizes and values that can be assigned on the variable.

Data types can be classified into two main categories:

value types and reference type.

1 Value Types: Store the value in stack

Structs: These are user-defined data types that can contain data members and methods. They are value types because they directly store their data and are typically used for small, simple data structures.

Enums: Enums are enumeration data types used to define a set of named integral constants. They are also value types and are often used to represent a set of related named constants.

Following are value types

int 4bytes

char 2bytes

bool 1bit

float 4bytes

double 8bytes

long 8bytes

2? Reference Types: Store the value in heap

String: Strings are sequences of characters and are reference types because they are stored in the managed heap and accessed through references.

Arrays: Arrays are collections of elements of the same type that are stored in contiguous memory locations. They are reference types as well.

Objects: Objects are instances of classes, which are user-defined reference types that encapsulate data and behavior.

Class: Classes are blueprints for creating objects. They define the structure and behavior of objects.

Interface: Interfaces define a contract that classes can implement. They specify methods, properties, events, and indexers that implementing classes must provide.

Delegate: Delegates are reference types that hold references to methods, allowing for method invocation through the delegate object.


要查看或添加评论,请登录

rama sharma的更多文章

  • Options for managing commits in GitHub Desktop

    Options for managing commits in GitHub Desktop

    In GitHub Desktop, you have several options for managing commits, making it easy to interact with your repository and…

  • How to Reorder Commits in GitHub Desktop

    How to Reorder Commits in GitHub Desktop

    Create Files and Commit: Create a file and perform the first commit. Create another file and perform a second commit.

  • Different Ways to Ignore Files Using GitHub Desktop

    Different Ways to Ignore Files Using GitHub Desktop

    Manually Add Folders and Files to .gitignore from GitHub Desktop Changes Section: Navigate to the Changes tab in GitHub…

  • Adding a repository from your local computer to GitHub Desktop

    Adding a repository from your local computer to GitHub Desktop

    Open GitHub Desktop. Click on File > Add Local Repository > Create a Repository.

  • How to Perform Git Clone Using GitHub Desktop?

    How to Perform Git Clone Using GitHub Desktop?

    Git clone is the process of creating a local copy of a repository hosted on GitHub, just like the Git command line git…

  • "Let's start exploring GitHub file -> Options" menu:

    "Let's start exploring GitHub file -> Options" menu:

    Here’s an explanation of the GitHub file -> Options" menu: a) Account This section is where you manage your GitHub…

  • How to Install GitHub Desktop on Windows?

    How to Install GitHub Desktop on Windows?

    System Requirements Operating System: Windows 10 or newer. Processor: 64-bit processor.

  • What is GitHub Desktop?

    What is GitHub Desktop?

    GitHub Desktop is a free and open-source application that provides a user-friendly graphical user interface (GUI) for…

  • C# - What is OOP?

    C# - What is OOP?

    In C#, Oops stands for Object-Oriented Programming. It's a programming paradigm based on the concept of "objects,"…

  • Control statements

    Control statements

    Control statements allows the smooth flow of a program. A control statement in c# is a statement that determines…

社区洞察

其他会员也浏览了