
Untitled
By: a guest on
Aug 1st, 2012 | syntax:
None | size: 0.90 KB | hits: 5 | expires: Never
Referencing non-static fields from static functions and vice versa impossible?
private static int getControlHeightToUse() {
return (dynamicPanel.Height / NUMBER_OF_ROWS);
}
private int getControlHeightToUse() {
return (dynamicPanel.Height / NUMBER_OF_ROWS);
}
public partial class CRLoginsMainForm : Form {
int controlHeight = getControlHeightToUse(); // <-- err
private static int getControlHeightToUse(Panel thePanel)
{
return (thePanel.Height / NUMBER_OF_ROWS);
}
public partial class CRLoginsMainForm : Form {
int controlHeight = getControlHeightToUse(dynamicPanel);
private static int getControlHeightToUse(Panel panel) {
return (panel.Height / NUMBER_OF_ROWS);
}
public class Foo
{
// public method
public void Method1()
{
}
public static void Data2()
{
// call public method from static method
new Foo().Method1();
}
}