C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 01-02-2002, 06:48 PM   #1
Banned
 
Troll_King's Avatar
 
Join Date: Oct 2001
Posts: 1,784
C# Type Checking Built In

Code:
using System;

namespace PracticeConsoleCS
{
	/// <summary>
	/// Testing Type Safety
	/// </summary>
	class Class1
	{
		static void Main(string[] args)
		{
			Console.Write("Enter an integer: ");
			int x = Convert.ToInt32(Console.ReadLine());
		}
	}
}
I only want a 32 bit integer and if the user enters a number that exceeds the type limit than C# throws an exception. This is great!
Troll_King is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you check what is wrong with this code Ron C++ Programming 4 08-01-2008 10:59 PM
Question on l-values. Hulag C++ Programming 6 10-13-2005 04:33 PM
Data type checking? Trauts C++ Programming 2 02-09-2003 05:24 PM
Warnings, warnings, warnings? spentdome C Programming 25 05-27-2002 06:49 PM
Type checking Araenor C Programming 10 08-29-2001 12:47 AM


All times are GMT -6. The time now is 06:44 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22