Skip to main content

Class ProfilerMarkerExtensionsForGenerator

Namespace:
Assembly: Aspid.FastTools.dll

Provides the extension methods that mark call sites for the profiler-marker source generator.

public static class ProfilerMarkerExtensionsForGenerator

Inheritance​

object ← ProfilerMarkerExtensionsForGenerator

Remarks​

Declared without a namespace, so code completion offers ProfilerMarkerExtensionsForGenerator.Marker<T> after any expression.

Methods​

Marker<T>(T, int)​

Opens the ProfilerMarker of this call site, named Type.Member (line).

public static ProfilerMarker.AutoScope Marker<T>(this T instance, int line = -1)

Parameters​

instance T

The instance of the calling type, usually this.

line int

The line of the call; filled in by the compiler.

Returns​

ProfilerMarker.AutoScope

The scope of the call site's marker; an empty scope when the call gets no marker.

Type Parameters​

T

The type of instance.

Remarks​

Only a call on an instance of the calling type gets a marker. Any other call gets no marker of its own, and analyzer AFT0010 reports it.

WithName(in AutoScope, string)​

Names the ProfilerMarker created for the preceding ProfilerMarkerExtensionsForGenerator.Marker<T> call.

public static ProfilerMarker.AutoScope WithName(this in ProfilerMarker.AutoScope marker, string name)

Parameters​

marker ProfilerMarker.AutoScope

The scope returned by ProfilerMarkerExtensionsForGenerator.Marker<T>.

name string

Replaces the member part of the marker name. Must be a compile-time constant: a literal, a const string, nameof(...), or their concatenation or interpolation; otherwise the name stays unchanged and analyzer AFT0014 reports it.

Returns​

ProfilerMarker.AutoScope

marker, unchanged.