Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for string interpolation conversions on user-defined methods #21

Open
DustinCampbell opened this issue Jul 22, 2015 · 3 comments
Assignees
Labels
Milestone

Comments

@DustinCampbell
Copy link
Owner

Just wanted to capture the suggestion made by @fsateler in issue #19 to allow users to annotate their own methods with a custom attribute which would allow the Convert to String Interpolation refactoring to run on them:

[FormatStringConsumer(FormatStringParameterNumber = 2)]
 void WriteToDevice(Device d, string format, params object[] arguments) { ... }
@pharring
Copy link
Contributor

Where does that attribute come from?

@fsateler
Copy link

@pharring it should be defined by CSharp essentials. This would probably require to provide the nuget package (#15)

@Bryan-Legend
Copy link

Resharper defines a StringFormatMethodAttribute for this:
http://www.jetbrains.com/resharper/help/Code_Analysis__String_Formatting_Methods.html

I've looked thru the .net framework in hopes of finding something built in and applicable, but couldn't find anything exact.

Perhaps we could use suppressmessageattribute to turn it on instead of off!
https://msdn.microsoft.com/en-us/library/system.diagnostics.codeanalysis.suppressmessageattribute(v=vs.110).aspx

Maybe [Category("Format")] or [Category("StringFormatMethod")]?
https://msdn.microsoft.com/en-us/library/system.componentmodel.categoryattribute.aspx?f=255&MSPPError=-2147217396

@DustinCampbell DustinCampbell modified the milestones: 1.0.4, 1.0.3 Sep 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants