Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 288763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:50:47+00:00 2026-05-12T05:50:47+00:00

Given a System.IO.FileStream object, how can I get the original path to the file

  • 0

Given a System.IO.FileStream object, how can I get the original path to the file it’s providing access to?

For example, in the MyStreamHandler() function below, I want to get back the path of the file that created the FileStream:

public static void Main() 
{
    string path = @"c:\temp\MyTest.txt";
    FileStream fs = File.Create(path));

    MyStreamHandler(fs);
    MyOtherStreamHandler(fs);

    fs.Close();
    fs.Dispose();
}

private static void MyStreamHandler(FileStream fs)
{
    // Get the originating path of 'fs'
} 

private static void MyOtherStreamHandler(FileStream fs)
{
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T05:50:47+00:00Added an answer on May 12, 2026 at 5:50 am

    The FileStream’s Name property.

    See documentation in MSDN

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given an absolute or relative path (in a Unix-like system), I would like to
Given this: Public Sub timReminder_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) If DateTime.Now()
I've got a System.Generic.Collections.List(Of MyCustomClass) type object. Given integer varaibles pagesize and pagenumber, how
Given a System.Windows.Controls.Control, how can I find the top left and bottom right corners
Given a System.Timers.Timer, is there a way from the main thread to tell if
Given two shorts ( System.Int16 ) short left = short.MaxValue; short right = 1;
Given an instance of System.Reflection.Assembly .
Given a source color of any hue by the system or user, I'd like
What recommendations can you give for a system which must do the following: Load
I have lots of code like this: FileStream fs = File.Open(@C:\Temp\SNB-RSS.xml, FileMode.Open); using (XmlTextReader

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.