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 8956839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:51:36+00:00 2026-06-15T14:51:36+00:00

Is it possible to switch between System.IO and the StorageFile methods depending on if

  • 0

Is it possible to switch between System.IO and the StorageFile methods depending on if the user is running Windows 8 or not, without having to create two separate projects? I know I can use System.IO in Windows 8, but I’d like to take advantage of the built in async methods if it’s possible (i.e. user is on Win8).

I don’t have a Windows 7 machine to test on at the moment, but I’m concerned that missing library errors may be thrown on the program’s startup. Is there a way to do this?

  • 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-06-15T14:51:37+00:00Added an answer on June 15, 2026 at 2:51 pm

    StorageFile class is not a part of .NET 4.5, it’s a part of Windows Runtime. Such classes can easily be recognized by their root namespace Windows. Windows Runtime API is available only on Windows 8 and is primarily designed for use in Windows Store apps. Although I haven’t tried it myself they can be used in desktop applications as well. Still I’m not sure how good that works for file IO classes since Windows store apps run in a sandboxed environment and have only limited access to file system based on the capabilities declared in their manifest.

    For file IO in a desktop application I’d stick with .NET classes in System.IO namespace. In .NET 4.5 there are several async methods available as well, mostly in Stream, StreamReader and StreamWriter classes and can be used for reading from and writing to files with the async/await paradigm. They are not bound to Windows 8 only, but they do require .NET 4.5 to be installed which excludes Windows XP.

    Unfortunately there’s no async method equivalent to StorageFile.GetBasicPropertiesAsync in .NET 4.5 that I know of. If you really need to make these calls async as well, you can always wrap the synchronous calls into your own async method which you can call from the UI thread.

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

Sidebar

Related Questions

I return empty collections vs. null whenever possible. I switch between two methods for
Possible Duplicate: How to switch an Application between Themed and not Themed at run-time?
is it possible to switch between Fragments without re-creating them all the time? If
Is it possible to have several command prompts running simultaneously and switch between them,
Is it possible to switch workspaces in Eclipse without relaunching the application? I want
Is it possible to switch between WiFi networks in WM 6 and .NET CF
I'm curious to know if it's possible to switch between Javascript insertRule and addRule
Possible Duplicate: How do I create a view that stays onscreen while I switch
I am trying to switch between two already started activities in android. I want
Hello is possible to switch between DML commands/operations (Insert,Delete,Update) on Trigger Body?, I try

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.