initial commit
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
public class RepositoryParserWorker
|
||||
{
|
||||
// Define a delegate for the method
|
||||
public Func<string, IEnumerable<string>> Selector;
|
||||
|
||||
public string[] dr;
|
||||
public int d;
|
||||
|
||||
// Constructor
|
||||
public RepositoryParserWorker()
|
||||
{
|
||||
// Initialize Selector with a valid method (if needed)
|
||||
Selector = new Func<string, IEnumerable<string>>(WriteAuthentication);
|
||||
}
|
||||
|
||||
// A method that matches the delegate signature
|
||||
public IEnumerable<string> WriteAuthentication(string file)
|
||||
{
|
||||
return Directory.GetFiles(this.dr[this.d], file, SearchOption.AllDirectories);
|
||||
}
|
||||
|
||||
// Example of a method that uses the selector delegate
|
||||
public void ProcessFiles()
|
||||
{
|
||||
string[] fileArray = new string[] { "filePattern1", "filePattern2" };
|
||||
foreach (var file in fileArray)
|
||||
{
|
||||
// Using the selector delegate to process files
|
||||
var files = Selector(file);
|
||||
foreach (var f in files)
|
||||
{
|
||||
Console.WriteLine(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user