Creating a non-trival custom GP tool - inputs, outputs, and responding to environment settings
' Copyright 2008 ESRI
' All rights reserved under the copyright laws of the United States
' and applicable international laws, treaties, and conventions.
' You may freely redistribute and use this sample code, with or
' without modification, provided you include the original copyright
' notice and use restrictions.
' See use restrictions at <your ArcGIS install location>/developerkit/userestrictions.txt.

Imports Microsoft.VisualBasic
Imports System
Imports ESRI.ArcGIS.Geoprocessing
Imports ESRI.ArcGIS.Geodatabase

Namespace GPPointFileInfo
  Public Class GPOutputMinAvgPtSpc
    Private Shared _parameterIndex As Integer

    Private Sub New()
    End Sub
    Public Shared Function GetGPParameterEdit() As IGPParameterEdit
      Dim gpParameterEdit As IGPParameterEdit = New GPParameterClass()

      Dim gpDataType As IGPDataType = New GPDoubleTypeClass()

      Dim gpValue As IGPValue = New GPDoubleClass()

      gpParameterEdit.Name = "out_output_min_avg_pt_spc"
      gpParameterEdit.DisplayName = "Output Min Avg Pt Spc"
      gpParameterEdit.DataType = gpDataType
      gpParameterEdit.Value = gpValue
      gpParameterEdit.Direction = esriGPParameterDirection.esriGPParameterDirectionOutput
      gpParameterEdit.ParameterType = esriGPParameterType.esriGPParameterTypeDerived

      Return gpParameterEdit
    End Function

    Public Shared Sub SetGPParameterIndex(ByVal index As Integer)
      _parameterIndex = index
    End Sub

    Public Shared Sub SetMinAvgPtSpc(ByVal parameterValueArray As IParameterValueArray, ByVal gpOutputFeatureClass As IGPOutputFeatureClass)
      Dim gpValue As IGPValue = parameterValueArray.GetGPValue(_parameterIndex)

      Dim gpDouble As IGPDouble = TryCast(gpValue, IGPDouble)

      gpDouble.Value = gpOutputFeatureClass.MinAvgPtSpc
    End Sub
  End Class
End Namespace