thunderchicken
asked on
C# classes
In a MS C# application, how would I do the following? I'd like to call another function without using the class names.
Main.cs
using System;
using System.Collections.Generic ;
using System.Text;
namespace IRule
{
class Program
{
static void Main(string[] args)
{
runme();
}
}
}
using System;
using System.Collections.Generic ;
using System.Text;
namespace CKann
{
public abstract class Foo
{
public static void runme()
{
string blah;
}
}
}
Main.cs
using System;
using System.Collections.Generic
using System.Text;
namespace IRule
{
class Program
{
static void Main(string[] args)
{
runme();
}
}
}
using System;
using System.Collections.Generic
using System.Text;
namespace CKann
{
public abstract class Foo
{
public static void runme()
{
string blah;
}
}
}
hi,
if runme() was a static function within Program you could do that otherwise you need to fully qualify it with a class/instance name.
if runme() was a static function within Program you could do that otherwise you need to fully qualify it with a class/instance name.
ASKER
Yeah, that's what I'm doing now, I don't want to do that.
Can you post some code that demonstrates what you are doing (i.e. what calls you are making) and what you would like to do?
i'm just curious at to why you wouldn't want to do that. Are you just after a shorthand for calling a method?
ASKER
I'm copying over a bunch of C code and I don't want to have to copy/paste the class name for each call. There's a ton of global variables / enums / etc that it's using and it's a way to make it cleaner.
if each method etc, was guaranteed to be uniquely named you could past it in then run through find replace for each method/enum and append the qualifying class/instance name, still pretty unwieldy process though.
Good luck!
Good luck!
ASKER
Yeah, that's what I'm doing now. I know you can do this stuff in VB.NET, wasn't sure about C#. Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Foo.runme()
i dont think u can skip the class name