If I create a new form called myForm, the top of myForm.h looks like this:
#pragma once
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections; //<<<< THIS ONE
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
None of these are even needed, because the wonderful forms designer always fully-qualifies its objects.
The one marked with THIS ONE is particularly annoying because it breaks my build. This is because I use the generic form of IList all over the place - I love it so much that I put it in stdafx.h, like this:
using System::Collections::Generic::IList;
So then if I want to use myForm from any other file where I happen to use IList, like this:
#include "StdAfx.h"
#include "ABC.h"
#include "myForm.h"
ABC::ABC()
{
IList<int>^ myList;
...
}
then it fails to compile:
1>.\ABC.cpp(7) : error C2872: 'IList' : ambiguous symbol
1> could be 'c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll : System::Collections::Generic::IList'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll : System::Collections::IList'
1>.\ABC.cpp(7) : error C2872: 'IList' : ambiguous symbol
1> could be 'c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll : System::Collections::Generic::IList'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll : System::Collections::IList'
So, how can I stop a new form from adding all these useless and destructive usings?