Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Improve "Add Member" for C#

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

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

Forum code is on.
Html is off.

Check to subscribe to this topic.

T O P I C    R E V I E W
Uniwares Posted - Jan 08 2021 : 05:09:46 AM
The current "Add Member" function is, to say it nicely, of limited value.

Would be very nice to have something more elaborate like:

-> Add Property -> Full property
                -> Autoproperty
                -> Property with backing field

-> Add Method   -> override from base
                -> new
                -> local method (when in a method)

... you get the idea
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jan 11 2021 : 08:34:02 AM
Basically adding a read only property then. I have put in a feature request for Create from Usage to create a C# property, and listed the different types we can create:


I have put in a feature request for Create From Usage to allow you to create a local method in C#, this is a logical extension of what we are already doing:


Not exactly what you described, but the idea of using Create from Usage to add a member / method to a base class has come up once before, so I have added your vote to the idea:

Uniwares Posted - Jan 08 2021 : 11:56:23 AM
As for the properties, you have one more option:
public bool IsReadable => true;

I think all the options are valid, although the IDE intellisense allows you to switch between them.

As for the methods, you are right, there are options to get to implement the base class / interface members, both in the IDE and VA.

The "Create from usage" I definitely never used, although time and again I use the IDE´s implement method for unknown methods (the Ctrl+. is just so handy)
feline Posted - Jan 08 2021 : 11:25:57 AM
For add property, what are you thinking of for these three types? Based on this page:


you basically have with, or without, explicitly declared storage:

class PropertyExamples
	private double _fullCount; // data for property with backing field
	public double FullCount // property with backing field
		get { return _fullCount; }
		set { _fullCount = value; }
	public double AutoDensity // auto property, data storage not explicitly defined
	{ get; set; }

you can also use expression body methods for get and set:

public double Minutes
	get => _seconds / 60;
	set => _seconds = value * 60; // should really error check

but I don't see that this matters for Add Member, unless you have a reason why we should consider adding this version?

For Add Method, adding a local method makes sense. I would expect to trigger this via Create from Usage:


unless you think it makes sense to trigger it from create similar method?

For override from base, how are you thinking this might work? If we are overriding an existing method in the base class then this already exists, via Implement Virtual Methods on the class its self. If instead you are thinking of creating a new method, and adding this both to the current class and to the base class, then this is a separate concept.

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