Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace UseDoubleAlias
- {
- class Program
- {
- static void Main(string[] args)
- {
- object value = 23.5;
- // "is" operator checks if given value can be converted to
- // given type.
- // Converting from object to other type - unboxing.
- // Note: Unboxing is one of the supported operations of
- // "is" operator.
- // See here for more on "is": http://msdn.microsoft.com/en-us/library/scekt9xw%28v=vs.71%29.aspx
- if (value is Double)
- {
- Console.WriteLine(value + " is Double.");
- }
- else
- {
- Console.WriteLine(value + " is not Double.");
- }
- if (value is System.Double)
- {
- Console.WriteLine(value + " is System.Double.");
- }
- else
- {
- Console.WriteLine(value + " is not System.Double.");
- }
- }
- }
- class Double
- {
- // Empty class(type) having the same name as System.Double.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement