consulo-csharp icon indicating copy to clipboard operation
consulo-csharp copied to clipboard

Override: twice or more hide methods impl with generic signature & object type

Open VISTALL opened this issue 10 years ago • 2 comments

using System;
using System.Collections.Generic;

public class Program {

    public static void Main(String[] args) {
        List<Object> list = null;


        object str = list[0];
    }
}

VISTALL avatar Jul 02 '15 07:07 VISTALL

VISTALL avatar Jul 02 '15 07:07 VISTALL

Simple example:

public interface A
{
    object test();
}

public class B<T> : A
{
    private object A.test()
    {
        return null;
    }

    public T test()
    {
        return default(T);
    }
}

public class Program
{
    public static void Main()
    {
        B<object> b = null;

        b.test();  // test is not resolved
    }
}

VISTALL avatar Jul 31 '15 17:07 VISTALL