Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
What is Type safe in C#?
Type safe in C# wouldn’t allow an object to sneak into other object’s memory. Let us see an example to understand the concept of −
Example
public class One {
public int Prop{ get; set;}
}
public class Two {
public int Prop{get;set;}
public int Prop1{get;set;}
}
Let’s say I have an object Class One −
One ob = new One();
Now you won’t be able to cast your object ob to the second class i.e. class Two. If you will cast it then a compile time error will arise because of the Type Safe feature in C#.
Advertisements
