G
Guest
Newbie using VC# Express.....
Part the First
========
Can some one tell me why Example 1 compiles and Example 2 does not...
Example 1
------------
using System;
namespace System.Data
{
partial class Console
{
public int GetHeight()
{
int i = System.Console.BufferHeight;
return i;
}
}
}
Example 2
------------
using System;
namespace System
{
partial class Console
{
public int GetHeight()
{
int i = System.Console.BufferHeight;
return i;
}
}
}
The error is: Error 2 'System.Console' does not contain a definition for
'BufferHeight'
In fact I seem to be able to use any namespace except "System".
Part the Second
==========
Why does the following fail to compile...
using System;
using System.Data;
namespace ClassLibrary1
{
public class Class1 { }
}
namespace System.Data
{
public partial class DataGrid
{
public static void AnyCall(DataGrid pGrid)
{
DataGrid dg = new DataGrid();
BindingContext bc = dg.BindingContext; // this line generates
the errors
}
}
}
The errors are:
Error 1 The type or namespace name 'BindingContext' could not be found (are
you missing a using directive or an assembly reference?)
Error 2 'ClassLibrary1.DataGrid' does not contain a definition for
'BindingContext'
So it can see a DataGrid, but not the properties of it.
It is obvious I do not understand namespaces / accessibility of references....
Part the First
========
Can some one tell me why Example 1 compiles and Example 2 does not...
Example 1
------------
using System;
namespace System.Data
{
partial class Console
{
public int GetHeight()
{
int i = System.Console.BufferHeight;
return i;
}
}
}
Example 2
------------
using System;
namespace System
{
partial class Console
{
public int GetHeight()
{
int i = System.Console.BufferHeight;
return i;
}
}
}
The error is: Error 2 'System.Console' does not contain a definition for
'BufferHeight'
In fact I seem to be able to use any namespace except "System".
Part the Second
==========
Why does the following fail to compile...
using System;
using System.Data;
namespace ClassLibrary1
{
public class Class1 { }
}
namespace System.Data
{
public partial class DataGrid
{
public static void AnyCall(DataGrid pGrid)
{
DataGrid dg = new DataGrid();
BindingContext bc = dg.BindingContext; // this line generates
the errors
}
}
}
The errors are:
Error 1 The type or namespace name 'BindingContext' could not be found (are
you missing a using directive or an assembly reference?)
Error 2 'ClassLibrary1.DataGrid' does not contain a definition for
'BindingContext'
So it can see a DataGrid, but not the properties of it.
It is obvious I do not understand namespaces / accessibility of references....