ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / StreamLayer Class / SetExpirationMethod Method
The ArcGIS.Core.CIM.FeatureExpirationMethod value indicates whether features will be expired or removed based on their age or feature count.
Example

In This Topic
    SetExpirationMethod Method (StreamLayer)
    In This Topic
    Sets the expiration method to the table. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Sub SetExpirationMethod( _
       ByVal featureExpirationMethod As FeatureExpirationMethod _
    ) 
    public void SetExpirationMethod( 
       FeatureExpirationMethod featureExpirationMethod
    )

    Parameters

    featureExpirationMethod
    The ArcGIS.Core.CIM.FeatureExpirationMethod value indicates whether features will be expired or removed based on their age or feature count.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Stream service data connection is null.
    Example
    Set the Maximum Count of Previous Observations to be Stored in Memory
    {
      // Note: call within QueuedTask.Run()
      {
        //Set Expiration Method and Max Expiration Count
        if (streamLayer.GetExpirationMethod() != FeatureExpirationMethod.MaximumFeatureCount)
          streamLayer.SetExpirationMethod(FeatureExpirationMethod.MaximumFeatureCount);
        streamLayer.SetExpirationMaxCount(15);
        //FYI
        if (streamLayer.IsTrackAware)
        {
          //MaxCount is per track! otherwise for the entire layer
        }
      }
    }
    Set the Maximum Age of Previous Observations to be Stored in Memory
    {
      // Note: call within QueuedTask.Run()
      {
        //Set Expiration Method and Max Expiration Age
        if (streamLayer.GetExpirationMethod() != FeatureExpirationMethod.MaximumFeatureAge)
          streamLayer.SetExpirationMethod(FeatureExpirationMethod.MaximumFeatureAge);
        //set to 12 hours (max is 24 hours)
        streamLayer.SetExpirationMaxAge(new TimeSpan(12, 0, 0));
    
        //FYI
        if (streamLayer.IsTrackAware)
        {
          //MaxAge is per track! otherwise for the entire layer
        }
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also