C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Structure in VB.Net - Part I


Posted Date: 11 Mar 2004    Resource Type: Articles    Category: .NET Framework
Author: Sadha SivamMember Level: Gold    
Rating: Points: 10



(This articles is purely meant for beginners in .Net)


Introduction
Structures are user defined value types. In this article we will discuss
various features of structures which .net framework provides.
As a programmer, we all must have heard about type.
What is a type ?
Types represent a combination of behavior and data storage requirements. When
our program runs, it creates instances of types(which allocates the data storage
required) and makes the behavior of the types available to us.

For each type, the complier knows How much memory to allocate when we create
a value of this type and also what operations we are allowed to perform using
the value.
The .Net framework defines the common language specification (CLS) to
facilitate seamless language interoperability.
Common Type System (CTS) is responsible for all the languages in .Net
Framework to interoperate smoothly. CTS specifies how to declare new types, how
to create instances of these types, and how the CLR manages the lifetimes of
these instances.
Basically, CTS categorizes the types into three divisions

  • Interfaces
  • Value Types
  • Reference Types

Now, I am interested only in the Value Types, Lets have a close look at the
value types and proceed with the Structures.
Value Types.
Value types represent entities that are essentially numerical in nature, such
as the date and time, colors, etc. Such entities can be represented by simple
binary number of a fixed length – the only complication is in interpreting the
meaning of the number.
Further, Value Type are composed of three main categories, they are

  • Primitive Types
    All the programming languages define primitive types
    such as integers, floating point numbers, and so on.
  • User Defined Value types
    Structures are user defined value types.
  • Enumerations
    An enumeration is a special kind of
    user-defined value type ( We will see more about Enumeration in my upcoming
    article "How Enumerations can be used in .Net".

Structures
Why is it required?
Say, for example we want to store a information of a student ie., rollno,
student name, class, section etc.,
This can be achieved in three different ways
Declaring them separately,

Disadvantages in this approach ,

  • When variables are declared in this fashion, we cannot
    handle them as a single entity.
  • And If we want to handle more than one student record, we need to declare
    that many no of variable and do our process.

Declaring them as a Class
This is also very good
approach, It brings all of them into one type, but the disadvantage of this
approach is the run-time overhead of garbage-collecting these simple objects
would be unnecessarily high.
Best approach is using a Structure.



See all the Structure in VB.Net Part 1, Part II , Part III,Part IV,Part V
Please send your valuable feed back to sadhasivam1981@yahoo.com.

Visit http://sadhasivam.t35.com to know more about me.





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Control Arrays in VB.Net
Previous Resource: Structures in VB.NET - Part II (Defining a structure)
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use