Intelliprompt for "new" Modifier

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 11 years ago by Tobias Römer
Version: 12.2.0571
Platform: .NET 4.5
Environment: Windows 8 (64-bit)
Avatar

Hello,

In the following code, the property type of IntValue.Value is recognized to be a System.Object instead of a System.Int32. Therefore the statement in Program.Main() is considered faulty (because you attempt to assign an object to an int. However, it is correct because the property Value is redefined (using the "new" modifier) with the generic type T, which is specialized to Int32 in class IntValue.

public static class Program
{

	public abstract class ValueBase
	{
		public abstract object GetValueObject();

		public object Value { get { return GetValueObject(); } }
	}

	public abstract class ValueBase<T>: ValueBase
	{
		public abstract T GetValue();

		public override sealed object GetValueObject();
		{
			return GetValue();
		}

		public new T Value { get { return GetValue(); } }
	}

	public class IntValue: ValueBase<int>
	{
		readonly int _value;

		public IntValue(int value)
		{
			_value = value;
		}

		public override int GetValue()
		{
			return _value;
		}
	}
	
	static IntValue _intValue = new IntValue(42);
	
	static void Main()
	{
	    int value = _intValue.Value;
	}
	
}

 (note: As i wrote this from my head without testing, there may be flaws. I hope its accurate enough for you to recognize the issue)

Thank you very much for taking a look at this. :)

Comments (2)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Tobias,

What version are you running?  After I corrected the extra semi-colon by GetValueObject(), if I hover over the Value part of _intValue.Value, I see "int" displayed, not "object".  This is with our latest codebase.  Isn't that what you're looking for?


Actipro Software Support

Posted 11 years ago by Tobias Römer
Avatar

Hi Support,

i updated from .570 to .571 and the problem is gone. My other issue with CType is gone as well. Shoud have done this before claiming a bug, sorry. Thank you very much. Your Intellisense engine really is extraordinary and a great improvement to our product!

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.