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. Working with own libaries

Working with own libaries

Scheduled Pinned Locked Moved C#
csharpvisual-studio
9 Posts 5 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.
  • N Offline
    N Offline
    neus83
    wrote on last edited by
    #1

    Hi all, I'm not a all day programmer, but C#/.Net is nice to get little administration processes. But nothing is good without good coding style... I will create a class which gives solutions to use if someone is calling this method. I.e. like (ImpLink, Internetwork). Sample Pic In my method I will give a way to select different switches by choise with this options. I know only this possiblity via "summary, and params" to give options for Intellisense

    A N _ 3 Replies Last reply
    0
    • N neus83

      Hi all, I'm not a all day programmer, but C#/.Net is nice to get little administration processes. But nothing is good without good coding style... I will create a class which gives solutions to use if someone is calling this method. I.e. like (ImpLink, Internetwork). Sample Pic In my method I will give a way to select different switches by choise with this options. I know only this possiblity via "summary, and params" to give options for Intellisense

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #2

      I'm afraid your question is not quite clear....

      The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick Visit the Hindi forum here.

      1 Reply Last reply
      0
      • N neus83

        Hi all, I'm not a all day programmer, but C#/.Net is nice to get little administration processes. But nothing is good without good coding style... I will create a class which gives solutions to use if someone is calling this method. I.e. like (ImpLink, Internetwork). Sample Pic In my method I will give a way to select different switches by choise with this options. I know only this possiblity via "summary, and params" to give options for Intellisense

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #3

        What is your question


        I know the language. I've read a book. - _Madmatt

        1 Reply Last reply
        0
        • N neus83

          Hi all, I'm not a all day programmer, but C#/.Net is nice to get little administration processes. But nothing is good without good coding style... I will create a class which gives solutions to use if someone is calling this method. I.e. like (ImpLink, Internetwork). Sample Pic In my method I will give a way to select different switches by choise with this options. I know only this possiblity via "summary, and params" to give options for Intellisense

          _ Offline
          _ Offline
          _Erik_
          wrote on last edited by
          #4

          Maybe you want to know how to make an enum[^]?

          N 1 Reply Last reply
          0
          • _ _Erik_

            Maybe you want to know how to make an enum[^]?

            N Offline
            N Offline
            neus83
            wrote on last edited by
            #5

            yes I think I'm walking a step forward. I was creating an enum and read out the integer. But how can I transfer enum values to a method ? At the moment i use "int MessageType" I will call the Method Loggerschema i.e: LoggerScheme(ex.ToString(),MessageType.Error); public enum MessageType1{Information=1,Error,Warning}; public void LoggerScheme(string ex, int MessageType) { if(MessageType==1) { // This is a Information Message // But I prefer to give Type "Information" instead 1 } if(MessageType==2) { // This is a Error Message // But I prefer to give Type "Error" instead 2 } if(MessageType==3) { // This is a Warning Message // But I prefer to give Type "Warning" instead 2 } }

            modified on Friday, November 5, 2010 10:53 AM

            _ L 2 Replies Last reply
            0
            • N neus83

              yes I think I'm walking a step forward. I was creating an enum and read out the integer. But how can I transfer enum values to a method ? At the moment i use "int MessageType" I will call the Method Loggerschema i.e: LoggerScheme(ex.ToString(),MessageType.Error); public enum MessageType1{Information=1,Error,Warning}; public void LoggerScheme(string ex, int MessageType) { if(MessageType==1) { // This is a Information Message // But I prefer to give Type "Information" instead 1 } if(MessageType==2) { // This is a Error Message // But I prefer to give Type "Error" instead 2 } if(MessageType==3) { // This is a Warning Message // But I prefer to give Type "Warning" instead 2 } }

              modified on Friday, November 5, 2010 10:53 AM

              _ Offline
              _ Offline
              _Erik_
              wrote on last edited by
              #6

              Use the name of the enum type, instead of int:

              public void LoggerScheme(string ex, MessageType1 MessageType)

              Edit And don't cast it to int, it is not necessary:

              if (MessageType == MessageType1.Information)
              ...

              N 1 Reply Last reply
              0
              • _ _Erik_

                Use the name of the enum type, instead of int:

                public void LoggerScheme(string ex, MessageType1 MessageType)

                Edit And don't cast it to int, it is not necessary:

                if (MessageType == MessageType1.Information)
                ...

                N Offline
                N Offline
                neus83
                wrote on last edited by
                #7

                Thanks a lot, that is the solution for all my problems :)

                _ 1 Reply Last reply
                0
                • N neus83

                  Thanks a lot, that is the solution for all my problems :)

                  _ Offline
                  _ Offline
                  _Erik_
                  wrote on last edited by
                  #8

                  You're welcome. I wish all of my problems were like this one... :laugh:

                  1 Reply Last reply
                  0
                  • N neus83

                    yes I think I'm walking a step forward. I was creating an enum and read out the integer. But how can I transfer enum values to a method ? At the moment i use "int MessageType" I will call the Method Loggerschema i.e: LoggerScheme(ex.ToString(),MessageType.Error); public enum MessageType1{Information=1,Error,Warning}; public void LoggerScheme(string ex, int MessageType) { if(MessageType==1) { // This is a Information Message // But I prefer to give Type "Information" instead 1 } if(MessageType==2) { // This is a Error Message // But I prefer to give Type "Error" instead 2 } if(MessageType==3) { // This is a Warning Message // But I prefer to give Type "Warning" instead 2 } }

                    modified on Friday, November 5, 2010 10:53 AM

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

                    Erik's example above is a good way of making things typesafe.

                    Join the cool kids - Come fold with us[^]

                    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