Q: how to remove
/* * This file is
The present disclo
Kentucky Football
--- abstract: 'Ion
It's just like a b
# # Copyright 2017
Q: What is the be
If this is your fi
Namco Bandai has n

Q: How to access
New Mexico Gov. Su
This invention rel
It may be just wee
AUSTIN - After two
Brasil: Ao menos c
In recent years, t
As part of a pilot
// SuperTux // C
The present invent
Q: How to create a class that contains multiple function definitions in C#? I want to create a class which can contain multiple functions, for example, I want to do this: class A{ public: void test1(); //function one void test2(); //function two void test3(); //function three } and if I want to add another function, I would do something like this: class A{ public: void test1(); //function one void test2(); //function two void test3(); //function three void test4(); //add new function } I am not good at C# as I have only learned in a few months, if there's anything that can improve my question, please let me know! Thanks! A: A C# class, or any kind of programming element, cannot have multiple definitions. The best you can do is a static method, and provide an instance as a parameter to that method. A: I think you mean 'public' methods. You have to mark one or more of the methods with the keyword 'static' to make them 'class' methods. A good place to start for learning C# is: http://www.csharp-station.com/Tutorials/. A: Make it static. public static void test1() { ... } public static void test2() { ... } ... public static void test5() { ... } Or, use C++/CLI style in C#. A: It's all about your C++ background. You have been used to create functions, methods and the like in different ways, and now you are coming to C# and seeing two different meanings of classes. The easiest way to call a group of functions from one method is to create a delegate: private delegate void DoSomething(); private DoSomething test1 { get { return delegate { foo(); } } private DoSomething test2 { get { return delegate { bar(); } } private DoSomething test3 { get { return delegate { baz(); } } private DoSomething test4 { get { return delegate { qux(); } } private DoSomething test5 { get { return delegate { gee(); } } private DoSomething test6 { get { return delegate { zap(); } } ...and call them like so: private void MyMethod(DoSomething doSomething) { if(doSomething == null) { return; } if (doSomething.MethodName == "foo") { // do foo } else if (doSomething.MethodName == "bar") { // do bar } else if (doSomething.MethodName == "baz") { // do baz } else if (doSomething.MethodName == "qux") { // do qux } else if (doSomething.MethodName == "gee") { // do gee } else if (doSomething.MethodName == "zap") { // do zap } } Alternatively, you can use a class instead of a delegate, and create multiple methods with different names: public class DoSomething { public void foo() { } public void bar() { } public void baz() { } public void qux() { } public void gee() { } public void zap() { } } public class MyMethod { private DoSomething doSomething; private void MyMethod(DoSomething doSomething) { if(doSomething == null) { return; } if (doSomething.MethodName == "foo") { // do foo } else if (doSomething.MethodName == "bar") { // do bar } else if (doSomething.MethodName == "baz") { // do baz } else if (doSomething.MethodName == "qux") { // do qux } else if (doSomething.MethodName == "gee") { // do gee } else if (doSomething.MethodName == "zap") { // do zap } } } You could do it that way, as well, it is up to you. A: You're looking for a static method (as the others have suggested). However, as @Ladislav mentioned, you shouldn't use static unless you're really that certain of your code won't need to be interacted with outside of the class. I'd suggest you use public void methods or classes (or whatever they're called in C#) instead, they're more flexible and you can even add an instance to the class and pass an instance to the method if you want. (This is not recommended for functions that don't need access to data that other classes can access though.)