protected void AddParams(FUNCDESC funcDesc,
								 String[] names,
								 int paramCount)
		{
			IntPtr elemPtr = funcDesc.lprgelemdescParam;
			for (int i = 0; i < paramCount; i++)
			{
				ELEMDESC elemDesc =
					(ELEMDESC)Marshal.PtrToStructure(elemPtr, 
													 typeof(ELEMDESC));
				ComParamInfo pi = new ComParamInfo
					(names[i + 1],
					 TypeLibUtil.TYPEDESCToString
					 (_typeLib,
					  _typeInfo,
					  elemDesc.tdesc,
					  TypeLibUtil.COMTYPE),
					 elemDesc.desc.paramdesc.wParamFlags);
				_parameters.Add(pi);
				// Point to the next one
				elemPtr = new IntPtr(elemPtr.ToInt64() + 
									 Marshal.SizeOf(elemDesc));
			}
		}
		protected void AddDomParams(FUNCDESC funcDesc,
									CodeMemberMethod meth,
									int limit)
		{
			IntPtr elemPtr = funcDesc.lprgelemdescParam;
			for (int i = 0; i < limit; i++)
			{
				ELEMDESC elemDesc =
					(ELEMDESC)Marshal.PtrToStructure(elemPtr, 
													 typeof(ELEMDESC));
				ComParamInfo parameter = (ComParamInfo)
					_parameters[i];
				String paramType = TypeLibUtil.TYPEDESCToString
					(_typeLib,
					 _typeInfo,
					 elemDesc.tdesc,
					 !TypeLibUtil.COMTYPE);
				String paramInOut = null;
				if ((parameter._paramFlags & PARAMFLAG.PARAMFLAG_FIN) != 0)
				{
					paramInOut = "In";
				}
				else if 
					((parameter._paramFlags & PARAMFLAG.PARAMFLAG_FOUT) != 0)
				{
					paramInOut = "Out";
					// Ref becomes out for an output parameter
					if (paramType.StartsWith("ref "))
						paramType = "out " + paramType.Substring(4);
					else
						paramType = "out " + paramType;
				}
				CodeParameterDeclarationExpression paramExpr =
					new CodeParameterDeclarationExpression
						(paramType, parameter._name);
				if (paramInOut != null)
				{
					paramExpr.CustomAttributes.Add
						(new CodeAttributeDeclaration
							("System.Runtime.InteropServices." + paramInOut));
				}
				meth.Parameters.Add(paramExpr);
				// Point to the next one
				elemPtr = new IntPtr(elemPtr.ToInt64() + 
									 Marshal.SizeOf(elemDesc));
			}
		}
		internal ComMemberInfo(BasicInfo parent,
							   TYPEKIND typeKind,
							   UCOMITypeInfo typeInfo,
							   int index,
							   bool dispatch,
							   FUNCDESC funcDesc) :
				base(typeInfo)
		{
			int actLen;
			String[] memberNames = new String[100];
			_typeInfo.GetNames(funcDesc.memid, memberNames, 
							   memberNames.Length, 
							   out actLen);
						
			_memberId = funcDesc.memid;
			// the high order part of the memberId is flags
			// for a dispatch interface
			if (dispatch)
			{
				_memberId &= 0xffff;
				// Make sure we get a 16 bit integer so that negative
				// DISPIDs show up correctly
				_memberId = (Int16)_memberId;
			}
			String docString;
			// Note, use the original unmasked memberId
			_typeInfo.GetDocumentation(funcDesc.memid, out _name, 
									   out docString, out _helpContext, 
									   out _helpFile);
			// Set using property so that nulls are checked
			DocString = docString;
			_parameters = new ArrayList();
			_typeLib = parent.TypeLib;
			_index = index;
			_container = parent;
			_printName = _name;
			_nameKey = (String)_name;
			// Add the DISPID to the dispatch interfaces
			if (dispatch)
			{
				_dispatch = true;
				_printName += " - " + _memberId;
			}
			if (TraceUtil.If(this, TraceLevel.Verbose))
				Trace.WriteLine("MemberInfo: " + _name);
			_type = TypeLibUtil.TYPEDESCToString
				(_typeLib,
				 _typeInfo,
				 funcDesc.elemdescFunc.tdesc,
				 TypeLibUtil.COMTYPE);
			if (funcDesc.invkind == INVOKEKIND.INVOKE_FUNC)
			{
				_infoType = "Function";
				_property = false;
				if (funcDesc.cParams > 0)
				{
					AddParams(funcDesc, memberNames, funcDesc.cParams);
				}
			}
			else
			{
				if (funcDesc.invkind == INVOKEKIND.INVOKE_PROPERTYGET)
				{
					_printName += " (get)";
					_nameKey += NAMEKEY_GET;
				}
				else if (funcDesc.invkind == INVOKEKIND.INVOKE_PROPERTYPUT)
				{
					_printName += " (put)";
					_nameKey += NAMEKEY_SET;
				}
				else if (funcDesc.invkind == INVOKEKIND.INVOKE_PROPERTYPUTREF)
				{
					_printName += " (put ref)";
					_nameKey += NAMEKEY_SETREF;
				}
				_infoType = "Property";
				_property = true;
			}
			_flagsString = FlagsString((FUNCFLAGS)funcDesc.wFuncFlags);
			if (_property)
			{
				_presInfo = PresentationMap.
					GetInfo(PresentationMap.COM_PROPERTY);
			}
			else
			{
				_presInfo = PresentationMap.
					GetInfo(PresentationMap.COM_METHOD);
			}
		}