15,917,971 members
See more:
Hallo everyone. plzzz do not rediect me to some other web source or somebody. its not a good way to answer.

AAnd my question is why recursive method used here. the class (
`CZKEM();`
) below from zkempeerer.dll. it is to connect and control scanner device.whats benefit of doing its method recursive? I never used recursion.

```class SomeClass{
CZKEM objCZKEM = new CZKEM();

#region 'What we will be using'

public bool BatchUpdate(int dwMachineNumber)
{
return objCZKEM.BatchUpdate(dwMachineNumber);
}

public bool Beep(int DelayMS)
{
return objCZKEM.Beep(DelayMS);
}

}```

What I have tried:

I have searched google and other web sources. but they say about difference between loop and recursion and iteration ...
Posted
Updated 1-Feb-19 10:01am

## Solution 1

There is no recursion in that code, nor is there a loop.
There may be recursion or iteration within the CZKEM class, but we can't see it if there is.

You do understand that recursion is calling a method (directly or indirectly) from itself, don't you?
C#
```public int factorial(int x)
{
if (x <= 1) return 1;
return x * factorial (x - 1);
}```
What you have in that code is not recursion, it is encapsulation[^] which is a very different thing altogether.

david salaman 13-Feb-18 4:38am
oh thnx for quick reply))). i don`t understand what it is((( explain plzz if you can. what`s going on here:in this code below
public bool Beep(int DelayMS)
{
return objCZKEM.Beep(DelayMS);
}
F-ES Sitecore 13-Feb-18 4:43am
If you don't understand such basic aspects of c# then you need to get a book on c# and start reading, we can't teach you such a broad topic from scratch. If we explain this one line you'll then want the next one explaining and the one after that. You ultimately want other people to do your work for you and that's not what this site is for.
OriginalGriff 13-Feb-18 4:50am
What part of it don't you understand?
I'm not trying to be funny here, but this is very, very basic stuff about classes - I have no idea what part of it you don;t understand, because anyone who can create a class should know exactly what is happening here!
The only slight complication is the technical term "encapsulation" - but that is very clearly explained in the search results I gave you.
david salaman 13-Feb-18 5:42am
public interface IZKEM
{
[DispId(3)]
[DispId(4)]
bool DeleteEnrollData(int dwMachineNumber, int dwEnrollNumber, int dwEMachineNumber, int dwBackupNumber);
[DispId(134)]
bool BatchUpdate(int dwMachineNumber);

........

using System.Runtime.InteropServices;

namespace zkemkeeper
{
[CoClass(typeof(CZKEMClass))]
[Guid("102F4206-E43D-4FC9-BAB0-331CFFE4D25B")]
public interface CZKEM : IZKEM, _IZKEMEvents_Event
{
}
}
Now what is purpose of doing this???

public class ZkemClient : IZKEM
{

CZKEM objCZKEM = new CZKEM();

public bool BatchUpdate(int dwMachineNumber)
{
return objCZKEM.BatchUpdate(dwMachineNumber);
}
}
can`t we use the methods in other ways???
OriginalGriff 13-Feb-18 5:54am
I can't tutor you on every detail, when you clearly haven't picked up the basics yet. You may have skimmed them, you may have had a lousy teacher, you may have just decided it was boring and not paid attention - I don't know.
But ... I do know that you need to understand the basics a whole load better before you start moving into more complex stuff - you seriously need to go right back to the beginning and start learning.