Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Inheriting from System.IO.FileStream

Inheriting from System.IO.FileStream

Scheduled Pinned Locked Moved C#
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bruzak
    wrote on last edited by
    #1

    Hi there, The following code generates the CS0122 "System.IO.FileStream.FileStream() is inancessible due to its protection level." What am I doing wrong? Thanks, Akos >>>>>>>>>> The code: using System; using System.IO; namespace MyStreamReader { /// /// Summary description for MyStreamReader. /// public class MyStreamReader : System.IO.FileStream { public MyStreamReader() { // // TODO: Add constructor logic here // } } }

    H 1 Reply Last reply
    0
    • B Bruzak

      Hi there, The following code generates the CS0122 "System.IO.FileStream.FileStream() is inancessible due to its protection level." What am I doing wrong? Thanks, Akos >>>>>>>>>> The code: using System; using System.IO; namespace MyStreamReader { /// /// Summary description for MyStreamReader. /// public class MyStreamReader : System.IO.FileStream { public MyStreamReader() { // // TODO: Add constructor logic here // } } }

      H Offline
      H Offline
      hooray
      wrote on last edited by
      #2

      the mistake in your code is that you are trying to use the default contructor of the filestream class. But this constructor isn't accessible. A solution to this problem is just using another constructor of the filestream class. You can call other constructors via the base synonym(as you can see in the following code). class b : System.IO.FileStream { public b(string str): base(str,FileMode.OpenOrCreate) { } }

      A 1 Reply Last reply
      0
      • H hooray

        the mistake in your code is that you are trying to use the default contructor of the filestream class. But this constructor isn't accessible. A solution to this problem is just using another constructor of the filestream class. You can call other constructors via the base synonym(as you can see in the following code). class b : System.IO.FileStream { public b(string str): base(str,FileMode.OpenOrCreate) { } }

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Beauty! Thanks Hooray! Akos

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups