当返回IList类型的方法的内容为空的时候怎么判断?

解决方案 »

  1.   

    IList<T> suibian = new List<T>();
    if(suibian == null)
    {……}
      

  2.   

    IList<T> 实例化对象 =new List<T>();
      

  3.   

    不好意思啊,没写完,接下来继续:呵呵!
    if(实例化对象!=null)
    {  
    }
      

  4.   

    IList <E> a = new List <E>();
    if(a==null)
    {
      return true;
      

  5.   

    可能没有说清楚
    意思就是一个这样的方法
    public IList<实体> fun(){
    IList<实体> st=new List<实体>();
    ...
    return st;
    }
    这样返回的时候,当调用这个方法时候,当为null或空的时候提示
    而我判断其为null也没有提示,为什么?
      

  6.   

    你都已经实例化了,所以不为null
    你判断st.Count==0好了,这样就是没有返回数据
      

  7.   


    IList <T> object = new List <T>(); 
    if(object.count != 0) 
    {
       return true;