How to create a "typedef to a function pointer" in C#?

KairisCharm

I'm converting code from C++ to C#. I have this line:

typedef bool (*proc)(int*, ...);

Can I do that in C#?

abelenky

Short answer: Yes.

Generally:
(untested... just an outline)

{
    bool AFunction(ref int x, params object[] list)
    {
        /* Some Body */
    }

    public delegate bool Proc(ref int x, params object[] list);  // Declare the type of the "function pointer" (in C terms)

    public Proc my_proc;  // Actually make a reference to a function.

    my_proc = AFunction;         // Assign my_proc to reference your function.
    my_proc(ref index, a, b, c); // Actually call it.
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From

How do I typedef a function pointer with the C++11 using syntax?

From Dev

Is `typedef` of a function standard C syntax, and how does it differ from a `typedef` of a function pointer?

From Dev

How to typedef a function pointer with template arguments

From Dev

C++ typedef function pointer and declare a pointer in one statement

From Dev

SWIG how to make a typedef function pointer in a struct callable from Python

From

Typedef function pointer?

From Dev

Typedef function pointer - differences between use & or not use it

From Dev

TypeDef with Function Pointer: Function does not Exist

From Dev

Are infinite typedef function pointer inheritances possible?

From Dev

Passing typedef function pointer as an argument problem

From Dev

typedef function pointer -> initialization from incompatible pointer type

From Dev

How to create Semaphores in c?

From Dev

How to create create a text files sequence in C

From Dev

How to create multibyte characters in C

From Dev

How to create a HashMap in C#

From Dev

How to create a closure for a C function

From Dev

How to create a "wrapper" in C++?

From Dev

How to create a matrix structure in C?

From Dev

How to create a whitelist in C language

From Dev

How to create try counter in C?

From Dev

How to create a command line in C?

From Dev

How to create a custom char in c?

From Dev

How to create Ruby Object from C Structure

From Dev

C# - How to create fixed size SortedList?

From Dev

How to create graphics with c++ on mac

From Dev

how to create html string dynamically in c#

From Dev

C++ how to create double class operator [][]

From Dev

how to create a 3 dimensional dictionary in C#

From Java

How to create a generator/iterator with the Python C API?

Related Related

  1. 1

    How do I typedef a function pointer with the C++11 using syntax?

  2. 2

    Is `typedef` of a function standard C syntax, and how does it differ from a `typedef` of a function pointer?

  3. 3

    How to typedef a function pointer with template arguments

  4. 4

    C++ typedef function pointer and declare a pointer in one statement

  5. 5

    SWIG how to make a typedef function pointer in a struct callable from Python

  6. 6

    Typedef function pointer?

  7. 7

    Typedef function pointer - differences between use & or not use it

  8. 8

    TypeDef with Function Pointer: Function does not Exist

  9. 9

    Are infinite typedef function pointer inheritances possible?

  10. 10

    Passing typedef function pointer as an argument problem

  11. 11

    typedef function pointer -> initialization from incompatible pointer type

  12. 12

    How to create Semaphores in c?

  13. 13

    How to create create a text files sequence in C

  14. 14

    How to create multibyte characters in C

  15. 15

    How to create a HashMap in C#

  16. 16

    How to create a closure for a C function

  17. 17

    How to create a "wrapper" in C++?

  18. 18

    How to create a matrix structure in C?

  19. 19

    How to create a whitelist in C language

  20. 20

    How to create try counter in C?

  21. 21

    How to create a command line in C?

  22. 22

    How to create a custom char in c?

  23. 23

    How to create Ruby Object from C Structure

  24. 24

    C# - How to create fixed size SortedList?

  25. 25

    How to create graphics with c++ on mac

  26. 26

    how to create html string dynamically in c#

  27. 27

    C++ how to create double class operator [][]

  28. 28

    how to create a 3 dimensional dictionary in C#

  29. 29

    How to create a generator/iterator with the Python C API?

HotTag

Archive