I have the following example code, and I am wondering if it it's possible to get the QuickInfo when hovering over the doesntResolveToDecimal to show decimal instead of OptionalDecimal as it does now. I have some operator overloads that I was expecting it to pick up on and use but it seems to ignore them, this same code works as expected in visual studio (hoovering over var shows the type is decimal in both cases)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TestNamespace
{
public struct OptionalDecimal
{
public bool HasValue { get { return false; } }
public static implicit operator decimal(OptionalDecimal obj) { return 0; }
public static decimal operator +(OptionalDecimal lhs, OptionalDecimal rhs) { return 0m; }
public static decimal operator -(OptionalDecimal lhs, OptionalDecimal rhs) { return 0m; }
public static decimal operator *(OptionalDecimal lhs, OptionalDecimal rhs) { return 0m; }
public static decimal operator /(OptionalDecimal lhs, OptionalDecimal rhs) { return 0m; }
}
public class Test {
public decimal TestMethod(OptionalDecimal lhs, OptionalDecimal rhs) {
var resolvesToDecimal = lhs + 0m + rhs;
var doesntResolveToDecimal = lhs + rhs;
return test;
}
}
}
In my use case the user is just editing the body of TestMethod and everything else is set in the header/footer. The reason for OptionalDecimal is due to having to match functionality of the existing design, where the user has to edit code that isn't exactly c# and gets translated before being actually compiled, but I would like the intellisense to be as accurate as possible to how the code will actually be compiled.