Files

41 lines
1.1 KiB
C#
Raw Permalink Normal View History

2026-08-27 11:21:42 -06:00
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);
}
}
}
}