Results 1 to 8 of 8

Thread: How is C# Sharp a type safe language ?

  1. #1
    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.

  2. #2
    Join Date
    May 2009
    Posts
    527

    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.

  3. #3
    Join Date
    Apr 2009
    Posts
    491

    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.

  4. #4
    Join Date
    May 2009
    Posts
    542

    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

  5. #5
    Join Date
    Apr 2009
    Posts
    570

    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.

  6. #6
    Join Date
    May 2009
    Posts
    513

    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.

  7. #7
    Join Date
    May 2009
    Posts
    546

    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."

  8. #8
    Join Date
    May 2009
    Posts
    640

    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.

Similar Threads

  1. Sharp 007SH Hybrid An 3D Clamshell Android Phone by Sharp
    By jackalz in forum Web News & Trends
    Replies: 3
    Last Post: 22-05-2011, 07:28 AM
  2. Replies: 1
    Last Post: 16-08-2010, 05:25 PM
  3. Replies: 1
    Last Post: 16-08-2010, 04:44 PM
  4. Data Types in C sharp language
    By Ram Bharose in forum Software Development
    Replies: 5
    Last Post: 28-12-2009, 10:56 AM
  5. Programming language C Sharp and its characteristics
    By Jesus-Ernesto in forum Software Development
    Replies: 4
    Last Post: 28-11-2009, 12:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •