using System.IO; var file = new FileInfo(@"C:\path\to\file.txt"); if (file.AlternateDataStreamExists(":stream")) { // The file has an alternate data stream called ":stream" } else { // The file does not have an alternate data stream called ":stream" }
using System.IO; var file = new FileInfo(@"C:\path\to\file.txt"); foreach (var stream in file.EnumerateAlternateDataStreams()) { Console.WriteLine(stream.Name); }In this example, we are again creating a new FileInfo object for a file located at `C:\path\to\file.txt`. We are then using the `EnumerateAlternateDataStreams` method to retrieve a list of all alternate data streams associated with the file. We are then looping through the list and printing out the name of each stream. The `AlternateDataStreamExists` method and the `EnumerateAlternateDataStreams` method are part of the System.IO namespace in the .NET Standard Library.