using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TypeCasting
{
class Program
{
static void Main(string[] args)
{
Program objProg = new Program();
objProg.MyMethod("I am Inayat");
Console.ReadKey();
}
void MyMethod(object obj)
{
if (obj is int)
{
Console.WriteLine("this is a int");
}
else if (obj is string)
{
Console.WriteLine("this is a string");
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TypeCasting
{
class Program
{
static void Main(string[] args)
{
Program objProg = new Program();
objProg.MyMethod("I am Inayat");
Console.ReadKey();
}
void MyMethod(object obj)
{
if (obj is int)
{
Console.WriteLine("this is a int");
}
else if (obj is string)
{
Console.WriteLine("this is a string");
}
}
}
}
0 comments:
Post a Comment