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. COM
  4. C# class library

C# class library

Scheduled Pinned Locked Moved COM
csharpcomquestion
2 Posts 2 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.
  • P Offline
    P Offline
    pnpfriend
    wrote on last edited by
    #1

    Hi I am creating dll using C#. I made the research and little bit confused with following: 1) does all the classes need Guid? 2) Does all the class need interface classes? or can I have just regular class without interface and Guid? [Guid("....")] public interface myclass_interface { .... } [Guid("...."), ClassInterface(ClassInterfaceType.None)] public class myclass_class:myclass_interface { .. } 3) Can library have static function/procedures so other classes can call them directly? 4) Can I have a class, that will not be calling from COM client, without a guid? Thank you.

    S 1 Reply Last reply
    0
    • P pnpfriend

      Hi I am creating dll using C#. I made the research and little bit confused with following: 1) does all the classes need Guid? 2) Does all the class need interface classes? or can I have just regular class without interface and Guid? [Guid("....")] public interface myclass_interface { .... } [Guid("...."), ClassInterface(ClassInterfaceType.None)] public class myclass_class:myclass_interface { .. } 3) Can library have static function/procedures so other classes can call them directly? 4) Can I have a class, that will not be calling from COM client, without a guid? Thank you.

      S Offline
      S Offline
      Scott Dorman
      wrote on last edited by
      #2

      pnpfriend wrote:

      ) does all the classes need Guid?

      No. This is only needed if you are going to access the class from COM.

      pnpfriend wrote:

      1. Does all the class need interface classes? or can I have just regular class without interface and Guid?

      No, classes are not required to implement an interface. Interface essentially allow you to define the "contract" that the class will provide. It does nothing to ensure how that contract is implemented but only that specific methods/properties will be available.

      pnpfriend wrote:

      Can library have static function/procedures so other classes can call them directly?

      The library can't, but an individual class can have static methods and/or properties that can be called without requiring an instance of that class.

      pnpfriend wrote:

      Can I have a class, that will not be calling from COM client, without a guid?

      This is pretty much the same as question 1, just asked inversely...so yes, you can have a class that isn't called from COM without a GUID.

      Scott. —In just two days, tomorrow will be yesterday. —Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai


      [Forum Guidelines] [Articles] [Blog]

      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