Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 method list ignores generics with constraints (C#)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tom_seddon
Tomato Guru

162 Posts

Posted - Feb 23 2008 :  2:26:06 PM  Show Profile  Reply with Quote
Hi

The following small file demonstrates the problem:


using System;
using System.Collections.Generic;
using System.Text;

namespace X
{
    abstract class Class1
    {
        public abstract void Test();
        public abstract void Test2<T>() where T:new();
        public abstract void Test3();
        public abstract void Test4();
    }
}


If you use the methods list on this file, you'll see that Test2 is not listed.

Remove the "where" clause, and it starts to appear.

If you give the functions bodies (replace ";" with "{}"), the methods list shows only functions that are before the constrained one in the file.

If you give Test2 a body consisting of an empty inner scope:


        public abstract void Test2<T>() where T:new()
        {
            {
            }
        }


then VAX does a slightly better job, ignoring only the constrained function and the one following it.

Thanks,

--Tom

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Feb 25 2008 :  08:05:42 AM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the very clear description.

case=6681

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000