using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
public class Form1
{
static void Main()
{
BindingSource bindSource = new BindingSource();
MyClass dataContainer = new MyClass();
ISupportInitialize bindSourceInit = bindSource;
ISupportInitialize dataInit = dataContainer;
bindSourceInit.BeginInit();
dataInit.BeginInit();
dataContainer.StringCollection = new List();
bindSource.DataSource = dataContainer;
bindSource.DataMember = "StringCollection";
bindSourceInit.EndInit();
dataInit.EndInit();
}
}
public class MyClass : ISupportInitialize
{
private List m_Data = null;
private bool m_Initializing = false;
private List m_TempData = null;
public List StringCollection
{
get
{
return m_Data;
}
set
{
if (m_Initializing)
m_TempData = value;
else
m_Data = value;
}
}
void ISupportInitialize.BeginInit()
{
m_Initializing = true;
}
void ISupportInitialize.EndInit()
{
m_Data = m_TempData;
m_Initializing = false;
}
}