Tag Archives: C#

This is a Permutations class which will calculate all permutations of a given array, by recursively calling a method within. Usage is rather simple that you need to just do a Permuter = new Permutation(AlphaSet) and then take the Permuter.Resultset array for all permutations.

As per feedback, the Permutation class has been modified to take in variable length string arrays also, instead of just single-character string arrays as in the example here. The method adopted (of running a proxy permutation first and mapping to real array) may not be the most efficient one. But it works! ;)

This class builds a file list out of a directory tree, starting from a specified folder. Search pattern (like *.asp, *.exe) and the level (or depth 0=all, 1=current, n=n levels) of recursion to number of sub-directories can be specified. Usage of the class is given towards the end of the article.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

using System;

using System.IO;

using System.Collections;

namespaceSpider

{

/// <summary>

/// Summary description for FileList.

/// </summary>

publicclassFileList

{

#region Vars

privatestring_Path;

privatestring_Pattern;

privateint_Recursion;

privateArrayList _Files;

#endregion

#region Public Methods

publicvoidBuild()

{

if(_Path!=null){

_Files=newArrayList();

BuildList(_Path,_Recursion);}

else

thrownewException("Path need to be set before you could call this function");

This is a simple (but often useful) tool to generate the xml schema of a database table. The tool supports only SQL Server over Windows Authentication. The source code here can be easily extended for other uses.