Refactor read-only property to method?

[v4.5.1288.2]
Hi

Is it possible to refactor a read-only property to a method?

E.g. if I have something like this:
interface Foo { int Bar { get; } }

I would like refactor this to:
interface Foo { int GetBar(); } }

and preferably change implementations from
class FooImpl { int Bar { get { return 2; } }

To
class FooImpl { int GetBar { return 2;} }

If not possible now, plans for adding it in future?

Thanks.

1 comment
Comment actions Permalink

Hello,

There is such refactoring, Convert Property to Method. See menu ReSharper
| Refactor | Convert

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


IR>
IR> Hi
IR> Is it possible to refactor a read-only property to a method?
IR>
IR> E.g. if I have something like this:
IR> interface Foo { int Bar { get; } }
IR> I would like refactor this to:
IR> interface Foo { int GetBar(); } }
IR> and preferably change implementations from
IR> class FooImpl { int Bar { get { return 2; } }
IR> To
IR> class FooImpl { int GetBar { return 2;} }
IR> If not possible now, plans for adding it in future?
IR>
IR> Thanks.
IR>
IR> ---
IR> Original message URL:
IR> http://www.jetbrains.net/devnet/message/5254275#5254275


0

Please sign in to leave a comment.