.NET : How do you get the Type of a null object?

前端 未结 12 1286
暗喜
暗喜 2020-11-28 13:59

I have a method with an out parameter that tries to do a type conversion. Basically:

public void GetParameterValue(out object destination)
{
    object param         


        
12条回答
  •  忘掉有多难
    2020-11-28 14:35

    //**The working answer**
    
    //**based on your discussion eheheheheeh**
    
    public void s(out T varName)
    {
        if (typeof (T) == typeof(HtmlTable)) 
        { 
             //////////       
        }
    
    }
    
    protected void Page_Load(object sender, EventArgs e) 
    {
        HtmlTable obj=null ;
        s(out obj);       
    }
    

提交回复
热议问题