private static CodeTypeDeclaration CraeteCodeInterfaceDeclaration(XpidlInterface xpidlInterface, out CodeTypeDeclaration codeConstClassDeclaration)
		{
			// Create interface declaration
			var codeInterfaceDeclaration =
				new CodeTypeDeclaration(xpidlInterface.Name)
				{
					IsInterface = true,
					TypeAttributes = TypeAttributes.Interface | TypeAttributes.NotPublic
				};

			// Set base interface (except of nsISupports)
			if (!String.IsNullOrEmpty(xpidlInterface.BaseName) && !String.Equals(xpidlInterface.BaseName, XpidlType.nsISupports))
			{
				codeInterfaceDeclaration.BaseTypes.Add(xpidlInterface.BaseName);

				var baseInterfaceMembers = new CodeSnippetTypeMember();
				baseInterfaceMembers.Comments.Add(
					new CodeCommentStatement(new CodeComment(String.Format("TODO: declare {0} members here", xpidlInterface.BaseName), false)));

				baseInterfaceMembers.StartDirectives.Add(
					new CodeRegionDirective(CodeRegionMode.Start, String.Format("{0} Members", xpidlInterface.BaseName)));
				baseInterfaceMembers.EndDirectives.Add(
					new CodeRegionDirective(CodeRegionMode.End, null));

				codeInterfaceDeclaration.Members.Add(baseInterfaceMembers);
			}

			// Add [ComImport] attribute
			var comImportAttributeDeclaration =
				new CodeAttributeDeclaration(
					new CodeTypeReference(typeof(ComImportAttribute)));
			codeInterfaceDeclaration.CustomAttributes.Add(comImportAttributeDeclaration);

			// Add [Guid] attribute
			var guidAttributeDeclaration =
				new CodeAttributeDeclaration(
					new CodeTypeReference(typeof(GuidAttribute)),
					new CodeAttributeArgument(new CodePrimitiveExpression(xpidlInterface.Uuid.ToString())));
			codeInterfaceDeclaration.CustomAttributes.Add(guidAttributeDeclaration);

			// Add [InterfaceType] attribute
			var interfaceTypeAttributeDeclaration =
				new CodeAttributeDeclaration(
					new CodeTypeReference(typeof(InterfaceTypeAttribute)),
					new CodeAttributeArgument(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(typeof(ComInterfaceType)), ComInterfaceType.InterfaceIsIUnknown.ToString())));
			codeInterfaceDeclaration.CustomAttributes.Add(interfaceTypeAttributeDeclaration);

			// Create interface members and get separate class for interface constants
			codeConstClassDeclaration = BuildCodeInterfaceDeclaration(codeInterfaceDeclaration, xpidlInterface);
			return codeInterfaceDeclaration;
		}
		private static CodeTypeDeclaration BuildCodeInterfaceDeclaration(CodeTypeDeclaration codeInterfaceDeclaration, XpidlInterface xpidlInterface)
		{
			CodeTypeDeclaration codeConstClassDeclaration = null;
			for (Int32 i = 0; i < xpidlInterface.ChildNodes.Count; ++i)
			{
				XpidlNode xpidlNode = xpidlInterface.ChildNodes[i];

				if (xpidlNode is XpidlConstant)
				{
					var xpidlConstant = (XpidlConstant) xpidlNode;

					// Create constants container class
					if (codeConstClassDeclaration == null)
					{
						codeConstClassDeclaration =
							new CodeTypeDeclaration(String.Format("{0}Constants", xpidlInterface.Name))
							{
								IsClass = true,
								TypeAttributes = TypeAttributes.Class | TypeAttributes.NotPublic | TypeAttributes.Sealed
							};
					}

					// Create constant member
					CodeMemberField codeConstantMember = CreateCodeMemberConstant(xpidlConstant);

					codeConstantMember.Comments.AddPrecedingComments(xpidlInterface, i);
					codeConstClassDeclaration.Members.Add(codeConstantMember);
				}
				else if (xpidlNode is XpidlAttribute)
				{
					var xpidlAttribute = (XpidlAttribute) xpidlNode;

					CodeMemberMethod codeSetterMethod;
					CodeMemberMethod codeGetterMethod = CreateCodeMemberAttribute(xpidlAttribute, out codeSetterMethod);
					
					codeGetterMethod.Comments.AddPrecedingComments(xpidlInterface, i);
					codeInterfaceDeclaration.Members.Add(codeGetterMethod);
					if (codeSetterMethod != null)
					{
						codeInterfaceDeclaration.Members.Add(codeSetterMethod);
					}
				}
				else if (xpidlNode is XpidlMethod)
				{
					var xpidlMethod = (XpidlMethod) xpidlNode;

					CodeMemberMethod codeMethod = CreateCodeMemberMethod(xpidlMethod);

					codeMethod.Comments.AddPrecedingComments(xpidlInterface, i);
					codeInterfaceDeclaration.Members.Add(codeMethod);
				}
			}
			return codeConstClassDeclaration;
		}