Skip to content

Instantly share code, notes, and snippets.

@ErgEnn
Last active July 14, 2023 10:05
Show Gist options
  • Save ErgEnn/37bdebc4ab28f586a19eaf1bf35398db to your computer and use it in GitHub Desktop.
Save ErgEnn/37bdebc4ab28f586a19eaf1bf35398db to your computer and use it in GitHub Desktop.
[Resharper CodeTemplateAttribute example for renaming] Example of how to use [CodeTemplate] annotation to make renaming easier when you can't directly rename occurances. E.g the renaming happened in Nuget package and needs to be shown to user at later time when they update to version with renamed property
using System;
using JetBrains.Annotations;
namespace Database
{
public class Address
{
[CodeTemplate(
searchTemplate:"$member$",
Message = "Renamed to "+nameof(Longitude),
ReplaceTemplate = "$qualifier$."+nameof(Longitude),
ReplaceMessage = "Rename to "+nameof(Longitude)
)]
[Obsolete("Renamed to Longitude", true)]
public double? Longtitude { get; set; }
public double? Longitude { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment