DiagnosticSource.StartActivity 方法

定义

重载

StartActivity(Activity, Object)

启动 Activity 并写入启动事件。

StartActivity<T>(Activity, T)

StartActivity(Activity, Object)

Source:
DiagnosticSourceActivity.cs
Source:
DiagnosticSourceActivity.cs
Source:
DiagnosticSourceActivity.cs

启动 Activity 并写入启动事件。

public:
 System::Diagnostics::Activity ^ StartActivity(System::Diagnostics::Activity ^ activity, System::Object ^ args);
public System.Diagnostics.Activity StartActivity (System.Diagnostics.Activity activity, object? args);
public System.Diagnostics.Activity StartActivity (System.Diagnostics.Activity activity, object args);
member this.StartActivity : System.Diagnostics.Activity * obj -> System.Diagnostics.Activity
Public Function StartActivity (activity As Activity, args As Object) As Activity

参数

activity
Activity

要启动的 Activity

args
Object

一个对象,它表示作为事件的有效负载传递的值。

返回

便于链接的已启动的活动。

注解

描述 Activity 逻辑操作、其上下文和父关系;当前 Activity 流经操作处理。

此方法启动给定 Activity的 ,为给定 Activity维护全局Activity.Current和活动Activity.Parent,并通知使用者已启动新的 Activity 。 使用者可以访问 Activity.Current 以添加上下文和/或扩充遥测数据。

生成者可将其他详细信息传递给有效负载中的使用者。

适用于

StartActivity<T>(Activity, T)

Source:
DiagnosticSourceActivity.cs
Source:
DiagnosticSourceActivity.cs
public:
generic <typename T>
 System::Diagnostics::Activity ^ StartActivity(System::Diagnostics::Activity ^ activity, T args);
public System.Diagnostics.Activity StartActivity<T> (System.Diagnostics.Activity activity, T args);
member this.StartActivity : System.Diagnostics.Activity * 'T -> System.Diagnostics.Activity
Public Function StartActivity(Of T) (activity As Activity, args As T) As Activity

类型参数

T

参数

activity
Activity
args
T

返回

适用于