Check if it is null.
if(chart1.DataSource == null)
{
}
If you know what a DataSource is, you can drop it and check if it is empty or not. For instance:
List<String> strings = new List<String>() { "a", "b" };
if(chart1.DataSource != null)
{
List<String> boundStrings = chart1.DataSource as List<String>;
if(boundStrings != null && boundStrings.Count > 0)
{
}
}
source
share