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

Rewrite some expression body definitions with lambda operator #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,14 @@ namespace SmartReactives.PostSharp.NotifyPropertyChanged
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class RaisesNotifyPropertyChangedAttribute : Attribute
{
public RaisesNotifyPropertyChangedAttribute()
{
}
public string ParameterName { get; private set; }

public RaisesNotifyPropertyChangedAttribute() { }

public RaisesNotifyPropertyChangedAttribute(string parameterName)
{
ParameterName = parameterName;
}

public string ParameterName { get; private set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ public sealed override void OnGetValue(LocationInterceptionArgs args)
}

/// <inheritdoc />
public override string ToString()
{
return "Sink from: " + property.GetType().Name + "." + property.Name;
}
public override string ToString() => $"Sink from: {property.GetType().Name}.{property.Name}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ public sealed override void OnGetValue(LocationInterceptionArgs args)
}

/// <inheritdoc />
public override string ToString()
{
return "Sink from: " + Property.GetType().Name + "." + Property.Name;
}
public override string ToString() => $"Sink from: {property.GetType().Name}.{property.Name}";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be Property with a capital :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)


public IEnumerable<AspectInstance> ProvideAspects(object targetElement)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ public abstract class SmartNotifyPropertyChangedVariableAttributeBase : Location
protected PropertyInfo property;

/// <inheritdoc />
public override string ToString()
{
// ReSharper disable once PossibleNullReferenceException
return "Source from: " + property.DeclaringType.Name + "." + property.Name;
}
public override string ToString() => $"Source from: {property.DeclaringType?.Name}.{property.Name}";

/// <inheritdoc />
public sealed override void OnSetValue(LocationInterceptionArgs args)
Expand Down
20 changes: 7 additions & 13 deletions SmartReactives.PostSharp/ReactiveCacheAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ public class ReactiveCacheAttribute : LocationInterceptionAspect, IInstanceScope
public object Value { get; set; }

public bool IsSet { get; set; }

public object CreateInstance(AdviceArgs adviceArgs)
{
return new ReactiveCacheAttribute();
}

public void RuntimeInitializeInstance()
{
}
public bool StrongReference => false;

public object CreateInstance(AdviceArgs adviceArgs) => new ReactiveCacheAttribute();

public void Notify() => IsSet = false;

public void RuntimeInitializeInstance() {}

public sealed override void OnGetValue(LocationInterceptionArgs args)
{
Expand All @@ -44,11 +43,6 @@ public sealed override void OnGetValue(LocationInterceptionArgs args)
}
}

public void Notify()
{
IsSet = false;
}

public bool StrongReference => false;
}
}