GPPointFileInfo\GPOutputMinAvgPtSpc.cs
Creating a non-trival custom GP tool - inputs, outputs, and responding to environment settings
GPPointFileInfo\GPOutputMinAvgPtSpc.cs
// 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.
// 

using ESRI.ArcGIS.Geoprocessing;
using ESRI.ArcGIS.Geodatabase;

namespace GPPointFileInfo
{
    public static class GPOutputMinAvgPtSpc
    {
        private static int _parameterIndex;

        public static IGPParameterEdit GetGPParameterEdit()
        {
            IGPParameterEdit gpParameterEdit = new GPParameterClass();

            IGPDataType gpDataType = new GPDoubleTypeClass();

            IGPValue gpValue = 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;
        }

        public static void SetGPParameterIndex(int index)
        {
            _parameterIndex = index;
        }

        public static void SetMinAvgPtSpc(IParameterValueArray parameterValueArray, IGPOutputFeatureClass gpOutputFeatureClass)
        {
            IGPValue gpValue = parameterValueArray.GetGPValue(_parameterIndex);

            IGPDouble gpDouble = gpValue as IGPDouble;

            gpDouble.Value = gpOutputFeatureClass.MinAvgPtSpc;
        }
    }
}