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
 Feature Requests
 Improve "Add Member" for C#
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic Next Topic  

Uniwares
Tomato Guru

Portugal
2084 Posts

Posted - Jan 08 2021 :  05:09:46 AM  Show Profile  Reply with Quote
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

feline
Whole Tomato Software

United Kingdom
17095 Posts

Posted - Jan 08 2021 :  11:25:57 AM  Show Profile  Reply with Quote
For add property, what are you thinking of for these three types? Based on this page:

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/properties

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:

https://support.wholetomato.com/default.asp?W164

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.

zen is the art of being at one with the two'ness
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2084 Posts

Posted - Jan 08 2021 :  11:56:23 AM  Show Profile  Reply with Quote
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)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17095 Posts

Posted - Jan 11 2021 :  08:34:02 AM  Show Profile  Reply with Quote
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:

case=144292

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:

case=144291

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:

case=29903

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