Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Find References - C# (expr is type varname) issue

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Tam�si D�nes Posted - May 27 2020 : 11:02:49 AM
In C#, you can do this:
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/is#type-pattern

For example:

object variable;
if(variable is SomeType sometype)
{
   sometype.MemberFunc(); // use - VA Find References will not work from here - BUG
}

Of course, you should declare and define the class, and the member function somewhere:

class SomeType
{
   public void MemberFunc(){} // declaration - VA Find References will work from here of course
}

But, if you try to 'Find References' for the MemberFunction with Visual Assist, it will work properly only if do it from the *declaration. If you do it from the *use, you will get the following window:
"Find References is not available because the symbol is unrecognized."

If you use the next syntax, it also work fine:

if(variable is SomeType)
{
   SomeType sometype = (SomeType) variable;
   sometype.MemberFunction(); // VA Find References will work!
}
1   L A T E S T    R E P L I E S    (Newest First)
feline Posted - May 27 2020 : 12:34:20 PM
I am seeing the same effect here. Thank you for the clear description.

case=142305

As a partial work around if you use Alt-G on "sometype" VA should take you back to the "if X is Y" line, and you can then quickly place the caret into the type, "SomeType" here, and use Alt-Shift-G, to bring up the Goto Related menu. The bottom item in this menu takes you to the "Members of..." dialog, which will give you a searchable list of all of the members of this type, and you can quickly run Find References from here, by selecting the item you want to find and pressing CTRL-F, or using the context menu.

Not quite the same, and since VA isn't handling this variable creation correctly the find results won't be perfect, but hopefully this will help.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000