BuildingCoder.NestedFamilyFunctions.GetFamilyParameter C# (CSharp) Метод

GetFamilyParameter() публичный статический Метод

Returns a reference to the FAMILY parameter (as a simple Parameter data type) on the given instance for the parameter with the given name. Will return the parameter whether it is an instance or type parameter. Returns null if no parameter on the instance was found.
Even though the data type returned is the more generic Parameter type, it will actually be for the data of the internal FamilyParameter object.
public static GetFamilyParameter ( FamilyInstance nestedFamilyInstance, string parameterName ) : Parameter
nestedFamilyInstance FamilyInstance An instance of a nested family file
parameterName string The name of the desired parameter to get a reference to
Результат Parameter
        public static Parameter GetFamilyParameter(
            FamilyInstance nestedFamilyInstance,
            string parameterName)
        {
            // Following good SOA practices, verify the
              // incoming parameters before attempting to proceed.

              if( nestedFamilyInstance == null )
              {
            throw new ArgumentNullException(
              "nestedFamilyInstance" );
              }

              if( string.IsNullOrEmpty( parameterName ) )
              {
            throw new ArgumentNullException(
              "parameterName" );
              }

              Parameter oResult = null;

              // See if the parameter is an Instance parameter

              //oResult = nestedFamilyInstance.get_Parameter( parameterName ); // 2014

              Debug.Assert( 2 > nestedFamilyInstance.GetParameters( parameterName ).Count,
            "ascertain that there are not more than one parameter of the given name" );

              oResult = nestedFamilyInstance.LookupParameter( parameterName ); // 2015

              // No?  See if it's a Type parameter

              if( oResult == null )
              {
            //oResult = nestedFamilyInstance.Symbol.get_Parameter( parameterName ); // 2014

            Debug.Assert( 2 > nestedFamilyInstance.Symbol.GetParameters( parameterName ).Count,
              "ascertain that there are not more than one parameter of the given name" );

            oResult = nestedFamilyInstance.Symbol.LookupParameter( parameterName ); // 2015
              }
              return oResult;
        }