Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How is C# Sharp a type safe language ?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 28-12-2010
Member
 
Join Date: Dec 2010
Posts: 59
How is C# Sharp a type safe language ?
  

Hello my friends , I just went through this forum and came to know that the questions posted in this forums are not just related to the technical support and hardware , I just saw a few threads regarding the programming and all its relevant topic. so I too decided to post a few questions on the C# programming language , since I am looking forward to do .NET course , I want to know about a few things about this language , can anyone tell me how C# is a type safe language.

Reply With Quote
  #2  
Old 28-12-2010
Member
 
Join Date: May 2009
Posts: 523
Re: How is C# Sharp a type safe language ?

A characteristic of powerfully typed languages like Visual C# and the Java language is the type safety . Type-safe programs utilizes memory only in official, well-defined, and allowable ways. Codes that are type safe will not be able to perform operations that would not be valid for a particular object. The Microsoft Visual C# and VB.NET language compilers generate type-safe programs ; and, type safety is confirmed during JIT-compilation. Also, the PEVerify tool can be used to verify code type safety.
Reply With Quote
  #3  
Old 28-12-2010
Member
 
Join Date: Apr 2009
Posts: 479
Re: How is C# Sharp a type safe language ?

Type safety is the means for creating code that is simple to preserve. A typesafe language (and framework) locates bugs during compilation instead of finding them during runtime (generally after you have transported the product). The main limitation in C# 1.x was the nonexistence of generics, which allows users to declare a general compilation (for instance, a stack or a list) that can take members of any kind yet will be type-safe during compilation compile time.
Reply With Quote
  #4  
Old 28-12-2010
Member
 
Join Date: May 2009
Posts: 531
Re: How is C# Sharp a type safe language ?

In Version 1.x of the framework, almost all the set were declared to clutch object of System.Object, and since everything derives from System.Object class , these set could accept any type at all; that is, for that reason they cannot be called as type safe . There is no requirement to cast when you recover objects from a generic collection, and your program is safer, simpler to maintain, and much more easier to use simpler to use
Reply With Quote
  #5  
Old 28-12-2010
Member
 
Join Date: Apr 2009
Posts: 564
Re: How is C# Sharp a type safe language ?

.NET 2.0 get rid of all these problems with a new library of stes , which you will be able to locate in the System.Collections.Generic namespace. A generic set is basically a collection that permits s you to denote its member types whenever they are being declared . After they are declared, the compiler will let only objects of that sort to be added to the given list. You define generic collections with the help of unique syntax; the syntax makes the use of angle brackets to show variables that are obliged to be defined when an object of the collection is declared. But I do not think you are required to go in that depth , it is just for your knowledge.
Reply With Quote
  #6  
Old 03-01-2011
Member
 
Join Date: May 2009
Posts: 500
Re: How is C# Sharp a type safe language ?

In the world of computer science, type safety is the extent to which a programming language blocks or stops type errors. A type error is mistaken or unwanted program behavior caused by a inconsistency between varying data types. Type safety is every so often or else considered to be a belongings of a computer program rather than the platform in which that program is coded; that is, some languages have type-safe services that can be circumvented by programmers who take on their work that demonstrate bad type safety. The formal type-theoretic description of type safety is considerably stronger than what is interpreted by many of the programmers. These types of features also enables automatic garbage collection of variables that are not been initialized.
Reply With Quote
  #7  
Old 03-01-2011
Member
 
Join Date: May 2009
Posts: 531
Re: How is C# Sharp a type safe language ?

Type enforcement can be static, catching possible errors during compilation , or dynamic, correlated with type information with values during the run time and consulting them as required to identify about to happen flaws and mistakes , or a mixture of both.The behaviors categorized as type errors by a given programming language are usually those that result from attempts to perform operations on values that are not of the suitable data type. This categorization is partially based on judgment; some language developers and implementers dispute that any operation not tending to any program is bound to crash, security errors or other clear breakdown is justifiable and are not supposed be considered an error, while others consider any breach of the developer’s explicit target to be mistaken and they are not "type-safe."
Reply With Quote
  #8  
Old 03-01-2011
Member
 
Join Date: May 2009
Posts: 609
Re: How is C# Sharp a type safe language ?

Type safety enables robust programs. C# incorporates a number of type safe measures.
  • All dynamically allocated objects and arrays are initialized to zero.
  • Use of any uninitialized variables produces an error messages by the compiler.
  • Access to arrays are range-checked and warned if it goes out-of-bounds.
  • C# does not permit unsafe casts.
  • C# enforces overflow checking in arithmetic operations.
  • Reference parameters that are passed are type-safe.
  • C# supports automatic garbage collection.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How is C# Sharp a type safe language ?"
Thread Thread Starter Forum Replies Last Post
Sharp 007SH Hybrid An 3D Clamshell Android Phone by Sharp jackalz Web News & Trends 3 22-05-2011 07:28 AM
Content Type | Mime Type for Office 2010 file format and extension ramsun Tips & Tweaks 1 16-08-2010 05:25 PM
Content Type | Mime Type for Office 2007 file format and extension D_chapple Tips & Tweaks 1 16-08-2010 04:44 PM
Data Types in C sharp language Ram Bharose Software Development 5 28-12-2009 10:56 AM
Programming language C Sharp and its characteristics Jesus-Ernesto Software Development 4 28-11-2009 12:06 AM


All times are GMT +5.5. The time now is 09:13 AM.