Data types in C#

Learn: C# programming information types: what number of kinds of information types accessible in C#? Which are the information types are in Value Types class and which are in Reference Types?

Information types characterize what and how the information ought to be put away and utilized. C# is a sort of safe language. Factors are announced as being of a specific kind, and every factor is compelled to hold just estimations of its proclaimed sort In C#, there are two sorts of information types are utilized:

  1. Worth Types
  2. Reference types
  • A variable of significant worth sorts legitimately contains just an article with the worth.
  • A variable of reference type legitimately contains a reference to an item. Another variable may contain a reference to a similar article.
  • We can characterize our own worth kinds by proclaiming counts or structures.

C# predefined information types

The information types which are predefined in the C# compiler, these are likewise alluded to as Basic Data Type of C#. The worth range (least and most extreme qualities) and size of these information types are predefined; anybody can not alter the range and size of these information types.

Here is the rundown of essential/predefined C# information types with type, size, extent and so on

Data types in C#

Picture source:

  • Example of Value Types is int A = 50; here factor A hold esteem 50 that can be utilized in program.
  • We can characterize new reference types class, interface, and agent revelations. Example of a reference type is:
object ABC = new object();
ABC.myValue = 50;    
  • Break Sequences and Verbatim Strings are utilized in C# string X = “\”Hello \nHow are you\””; Here \n is utilized for a print new line and \” is utilized to print twofold cite on reassure screen.

Leave a Comment

error: Alert: Content is protected!!