المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : type object



C# Programming
05-24-2010, 07:10 AM
hello everyone

I want to know how to specify the type of a variable declared as Object
better:
I have a variable type object, and I want to test whether this object is string it will make me so and so instrution and if this object and int, and so on.

thank you
Here is a snippet incomplet:

public static string Format(string format, object val,int length)
{
LineDefinition LD;
string var;
if (val.GetType() )

var = string.Format(LD.Format , val).PadRight (LD .Length ,' ');
var = string.Format(LD.Format, val).PadLeft (LD.Length, '0');
return var;