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
  1. Home
  2. General Programming
  3. C#
  4. Loading .cs file from FileSystem as Object?

Loading .cs file from FileSystem as Object?

Scheduled Pinned Locked Moved C#
question
4 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.
  • R Offline
    R Offline
    robert110
    wrote on last edited by
    #1

    I create a class file dynamically and save it on the file system in a class.cs file. How can I load that file as a class object and bind it to PropertyGrid? Thanks.

    S J 2 Replies Last reply
    0
    • R robert110

      I create a class file dynamically and save it on the file system in a class.cs file. How can I load that file as a class object and bind it to PropertyGrid? Thanks.

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      You'll have to dynamically compile your generated class file (take a look at the Microsoft.CSharp and System.CodeDom.Compiler namespace), load the generated assembly and create an object of your class using Activator class.


      "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

      www.troschuetz.de

      1 Reply Last reply
      0
      • R robert110

        I create a class file dynamically and save it on the file system in a class.cs file. How can I load that file as a class object and bind it to PropertyGrid? Thanks.

        J Offline
        J Offline
        Jonathan van de Veen
        wrote on last edited by
        #3

        I guess you would have to compile the class into an assembly first. Then load the compiled assembly and create an instance of the class and then bind it to the propertygrid. If you need details, just ask.

        R 1 Reply Last reply
        0
        • J Jonathan van de Veen

          I guess you would have to compile the class into an assembly first. Then load the compiled assembly and create an instance of the class and then bind it to the propertygrid. If you need details, just ask.

          R Offline
          R Offline
          robert110
          wrote on last edited by
          #4

          I need details please :).

          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