For .Net 5 and above:
use nameof (credits to m-kazem-akhgary)
For .Net 4.5v and below:
using System;
using System.Linq.Expressions;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using LazyHelper = DotNetSandbox.InterfaceNames>;
namespace DotNetSandbox
{
// Use case / Example:
[TestClass]
public class InterfaceNamesTests
{
[TestMethod]
public void InterfaceNamesTest()
{
// Option 1 - Not strongly typed
string nameA = typeof(IConvertible).GetMethod("ToBoolean").Name;
Console.WriteLine(nameA); // OUTPUT: ToBoolean
string nameB = typeof(Lazy
Resources
Using obect's property names in strongly type way
C# Strongly Typed Attribute member to describe property
Get the name(s) of interface methods strong typed
Waiting for your input / suggestions / insights...