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. Please tell me why

Please tell me why

Scheduled Pinned Locked Moved C#
helpquestion
3 Posts 2 Posters 2 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    object obj = Activator.CreateInstance(type); arraylist.Add(obj); generates the following compile error: Value null was found where an instance of an object was required. Yet this code works fine so its obvious that obj is not null...isnt it ? object obj = Activator.CreateInstance(type); IInterface i = (IInterface)obj; i.InvokeAMethod();

    J 1 Reply Last reply
    0
    • L Lost User

      object obj = Activator.CreateInstance(type); arraylist.Add(obj); generates the following compile error: Value null was found where an instance of an object was required. Yet this code works fine so its obvious that obj is not null...isnt it ? object obj = Activator.CreateInstance(type); IInterface i = (IInterface)obj; i.InvokeAMethod();

      J Offline
      J Offline
      James T Johnson
      wrote on last edited by
      #2

      have you done arraylist = new System.Collections.ArrayList;? wouldn't be the first time I've forgotten to do that :) James Sonork ID: 100.11138 - Hasaki "Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. :-D" - Michael P Butler Jan. 18, 2002

      L 1 Reply Last reply
      0
      • J James T Johnson

        have you done arraylist = new System.Collections.ArrayList;? wouldn't be the first time I've forgotten to do that :) James Sonork ID: 100.11138 - Hasaki "Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. :-D" - Michael P Butler Jan. 18, 2002

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        I CANT BELIVE THAT!!! how did i miss that

        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