VisualBuilder
  Home > Dotnet > Tutorials > Type System in .Net -1 - .NET Tutorial
Tell a friend
Link to us
Total Members
      Members: 84606
     
Sitemap Forum Chat
Home
.NET Tutorial Home
1 . Overview of .Net Framework
2 . .Net Components:
3 . CLR (Common Language Runtime)
4 . Steps to Run a program in CLR
5 . Assembly
6 . GAC (Global Assembly CACHE)
7 . Strong Name in .Net Assembly
8 . ILDASM: Intermediate Language Disassembler in .Net
9 . Custom Attributes in .Net
10 . Application Domain in .Net
11 . Code Access Security in .Net
12 . Type System in .Net -1
13 . Type System in .Net -2
14 . Reflection: Inspection of a Type\'s Metadata
15 . Introduction to Generics
16 . Generic Classes and Methods
17 . Generic Methods in .Net 2.0
18 . Overview of Inheritance in Generics classes
19 . Connection pooling in .Net Applications
20 . Deployment in .Net
 
Dotnet Group Home
Dotnet Discussion (9)
Dotnet Members (2825)
Dotnet Resources
Dotnet Source Code (0)
Dotnet Articles (0)
Dotnet Blogs
Dotnet Jobs
Dotnet Components (2)
Dotnet Books
Dotnet Websites (43)
Dotnet News (186)
Dotnet Q & A (3)
- Dotnet Ask Question
- Dotnet Questions
- Dotnet Unanswered Questions
 
GROUPS
.NET
ASP.NET
.NET
C#
ASP
Visual Basic
Java
Java
JSP
EJB
Other
Delphi
C++
Ajax
UML
JavaScript
PHP
Web Design
Web Hosting
SQL Server
Oracle
Project Management
More Groups

 
LEARNING CENTER
TUTORIALS
.NET
.NET Tutorial
ASP Tutorial
ASP.NET Database Tutorial
ASP.NET Development Tips
ASP.Net Security,Internationalisation And Deployment
ASP.NET Server Controls Tips
ASP.NET Tutorial
C Sharp Tutorial
Web Development
Flex Tutorial
HTML Tutorial
Learn AJAX Tutorial
PHP Tutorial
Software Development
Database Tutorial
SQL Tutorial
UML Tutorial
Java
Ant Tutorial
EJB 3 Tutorial
Hibernate Tutorial
Java Tutorial
Java Web Component Tutorial
Java XML Tutorial
JDBC Tutorial
JDK1.5 Tutorial
JSF Tutorial
JSP And J2EE Design Tutorial
JSP Tutorial
Spring Tutorial
Struts Tutorial

RESOURCES
Q & A (432 )
Source Code (3217 )
Articles (11 )
Components (1589 )
News (880 )
Websites (1207 )

SUBMISSIONS
Submit Article
Submit Website
Submit News
Submit Source Code
Submit Component

COMMUNITY
Members Directory
Discussion Forum
Chat

SITE
About Us
Sitemap
Search
Contact Us
Link To Us
Feedback
Tell a Friend
Partners
Advertise


Dotnet Tutorial
 Type System in .Net -1
  << Prev: Code Access Security in .Net Next: Type System in .Net -2 >>

Using the .NET Framework, developers can both define and share types. Defining and sharing new types in a single language is not particularly challenging; allowing a newly defined type to be used in other languages is much more problematic. This type system will help developers to achieve the concepts of interoperability.


 


Elements of the CLR Type System









Value Type:


A value type consists of a sequence of bits in memory, such as a 32-bit integer. Any two 32-bit integers are considered equal if they hold the same number—that is, if the sequence of bits is identical. Value types represent types that are known as simple or primitive types in many languages. They include types such as int and float in C++ and Java. Value types are often allocated on the stack, which means that they can be local variables, parameters, or return values from functions.


 


The following Types comes under the value type:-


 


1. Boolean Values :-The bool type is used to represent true and false values. Unlike some languages that use an integer for this type (so that a value such as 0 represents false and all other values represent true), the CLR designates a specific type for this purpose.


CIL Name: bool


Base Framework Name: System.Boolean


 


2.Characters :- All characters in the CLR are 16-bit Unicode code points . The UTF-16 character set uses 16 bits to represent characters; by comparison, the ASCII character set normally uses 8 bits for this purpose. This point is important for a component model such as the .NET Framework, for which distributed programming over the Internet was a prime design goal of the architecture.


 


3. Integers :-The CLR supports a range of built-in integer representations. Integers vary in three ways:



  • Their size can be 8, 16, 32, or 64 bits. This range covers the size of integers in many common languages and machine architectures.

  • Integers can be signed or unsigned, designating whether the values they hold are positive only or positive/negative.

  • Native integers are used to represent the most natural size integer on the execution architecture. Because the CLR is designed to run on a number of different platforms, it needs a mechanism to inform the execution engine that it is free to choose the most efficient representation on the platform that the code executes on—hence the native integer type.


4] Floating-point Types: - CLR floating-point types vary between 32- and 64-bit representations and adhere to the IEEE floating-point standard


 


5] User-Defined Value Types: -The following are the User-Defined Types in .Net



  • Enumerations: :-An enumeration is a special kind of value type limited to a restricted and unchangeable set of numerical values.Enums are strongly typed constants. They are essentially unique types that allow you to assign symbolic names to integral values. Example:-
    using System;
    namespace Enumeration {
    struct EnumerationSample {
    enum Month {
    January = 1, February,
    March, April,
    May, June,
    July, August,
    September, October,
    November, December}

    static int Main (string[] args) {
    Console.WriteLine("{0} is month {1}", Month.September,(int) Month.September); return 0;
    }
    }
    }



  • Structure: -Some languages, such as Managed C++, allow users to use a keyword such as classwhen defining either value or reference types. Other languages, such as C#, use a keyword such as struct to indicate a user-defined value type and class to indicate a user-defined reference type. Structures can contain Methods (both static and instance), Fields (both static and instance) , Properties (both static and instance) and  Events (both static and instance).


 


 


 


  << Prev: Code Access Security in .Net Next: Type System in .Net -2 >>
Dotnet Tutorial Home
Give feedback and win a prize.

 
   Printer Friendly
   Email to a friend
   Add to my Favourites    
  Download PDF version
   Report Bad Submissions
   Submit Feedback
 
  Delicious   Digg   Technorati   Blink   Furl   Reddit   Newsvine   Google Click each image to add
this page to each site.
 
 
Welcome Guest Signup
MEMBER'S PANEL
EMAIL
PASSWORD
Forgot your password?
New User? Click Here!
 
Resend Activation Email!
 
SEARCH
 
 
LINKS
MSN
Video Surveillance
Exchange Hosting
Gift to Pakistan
 
ADVERTISEMENT
 
PARTNER LIST

More
 
 
 

Home | Login | About Us | Contact Us | Privacy Policy | Advertising