From what I've read, C#'s static modifier should work just like Java. So, I created a utilities class which has a public static method to do some things. The utilities class is declared within the same namespace as my form class (just in a separate file), but if I attempt to access the method in the utilities class from the form class, the compiler complains that the name of the utility method or the class (if I attempt to use the FQN of the method) does not exist in the current context.
If I attempt to add a "using MyNamespace.Utilities" statement at the top (which I fully expect to be redundant) the compiler also complains that the "Utilities" type or name does not exist in "MyNamespace".
Any suggestions are most welcome! According to wrox, I'm doing this correctly...

static class/method not recognized within namespace
matthew_arena
I'll agree with James: seeing the code would make this easier.
Another hunch:
If Utilities is a class, you must use the namespace:
using MyNamespace;
And scope the method call using the class name:
Utilities.MyCoolMethod(...);
Hope that helps.
Stephen S1
The MotorUtilities class is defined in a file named MotorUtilities.cs.
Jerry Ou
I can tell you what's wrong with your code, if you don't let me see it....
Things to check:
Is the class declared public
Is the method declared public
susantez
Michal Szalai
Is MotorUtilities in a different project The only way I have been able to replicate the problem you are seeing is by putting the MotorUtilities class in its own project and then not referencing it from the Forms application project.
Regards,
Donavan
jhapps
Jonathan,
The 'static' modifier does not work like Java's static import feature. The static modifier is applied to a class, and indicates to the compiler that the class is a static holder class, that is, a class that contains only static members. However, you can't 'import' that class like a namespace, you will still need to prefix any methods in the static class with the class name itself.
Regards
David
Bastiaan Molsbeck
Below is the utility class snippet followed by code from the form class (with the utility method highlighted in bold):
namespace RCAWS_GUI
{
public static class MotorUtilities
{
unsafe static public byte[] convertMotorData(MotorType type, int rawData)
{
//deletia
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using IbisTekUtilities;
using System.Net;
using System.Diagnostics;
using System.Net.Sockets;
using System.IO;
using System.Threading;
namespace RCAWS_GUI
{
public partial class frmMain : Form
{
ButtonState prevDeadmanState = ButtonState.RELEASED;
int prevLeftJoyY = 128;
// ------------------------------------------------------------
// Left Analog Joystick
// The left joystick is mapped to Motor Control.
// ------------------------------------------------------------
void gamepad_leftAnalogJoyMoved(int axisX, int axisY)
{
byte[] data = new byte[4];
// Only do something if the deadman switch is pressed
if (prevDeadmanState == ButtonState.PRESSED)
{
if (axisX != 128)
// joystick is pushed left or right of center
{
prevLeftJoyX = axisX;
data = MotorUtilities.convertMotorData(MotorType.EL, axisY);
}
if (axisY != 128)
// joystick is pushed up or down of center
{
prevLeftJoyY = axisY;
data = MotorUtilities.convertMotorData(MotorType.EL, axisY);
}
} // END if deadman PRESSED
} // end gamepad_leftAnalogJoyMoved
// deletia
} // END class Form
} // END namespace RCAWS_GUI
Again, many thanks to everyone for their input. I'm certain there is something blatantly obvious to someone who's not a newbie.