nameof Questions
1
Solved
Take the following class and method:
public class Foo
public Foo Create(string bar) {
return new Foo(bar);
}
So getting "Create" is obvious: nameof(Foo.Create)
Is there any way to get "bar" ...
2
Solved
Is there a way to get the name of the current property in a getter/setter?
Something like this:
public string MyProperty
{
get { return base.Get<string>(nameof(ThisProperty)); }
set { bas...
2
Solved
One of the handiest new features in C# 6 is nameof, which allows the programmer to effectively eliminate the use of magic strings.
Per the documentation, nameof returns a string:
Used to obtain...
1
Solved
class Foo<T>
{
public T Bar() { /* ... */ }
}
I'd like to pass Bar's name to Type.GetMethod(string). I can do this as someType.GetMethod(nameof(Foo<int>.Bar)), but that int is wholly...
2
Solved
From what I can read the compiler just emits a string and nothing else really happens?
Is there any reason that the results of this call couldn't be interned? For a nameof(MyClass), if it happens ...
Unable asked 13/8, 2015 at 15:59
2
Solved
I want to use the nameof operator in my C# project in Visual Studio 2015 but the compiler complains with the following message.
Feature 'nameof operator' is not available in C# 5. Please use
la...
Epistrophe asked 10/8, 2015 at 6:9
2
Solved
I'm using the nameof function to get a property name as a string thus:
public bool IsRunning => ...;
...
RaisePropertyChanged(nameof(IsRunning));
ReSharper highlights this with the warning:
E...
Doit asked 7/8, 2015 at 10:13
1
Solved
The new C# 6.0 nameof is great in the PropertyChanged pattern for propagating property changes using something like:
private string _myProperty;
public string MyProperty
{
get
{
return _myProp...
2
Solved
With the advent of .NET 4.5.3, WPF developers now have three (or more) ways to notify the INotifyPropertyChanged Interface of property changes. Basically, my question is Which of the two methods in...
Kaikaia asked 8/2, 2015 at 17:51
© 2022 - 2024 — McMap. All rights reserved.