none
How to use class library? RRS feed

  • Question

  • Hi,
    i want to write programs with C# language and Visual studio ,
    But i can't do it correctly.
    for example i want to see usage information   of network card but i don't know where to use these classes and parameters and propertise.
    another example that :
    i want to use GatewayIPAddressInformation
    but i can't use this class its somehow hard to understand.
    where can i find solution for my problem?
    Thanks.
    Saturday, June 17, 2017 8:06 PM

All replies

  • Hello Armin,

    Probably the best way to start is looking at some tutorials: http://www.java2s.com/Tutorial/CSharp/0580__Network/ReportinformationfromNetworkInterfacenetworkstatistics.htm

    Also, performance counters might also be a way of solving this: http://dotnet-snippets.com/snippet/show-network-traffic-sent-and-received/580


    Cheers, Jeff

    Monday, June 19, 2017 12:15 AM
  • I'll add reply for the "How to use the libraries" part.

    First, I'll point you to the documentation for the function GatewayIPAddressInformation class. As you can see, it tells you the namespace the class is located (System.Net.NetworkInformation). Now scroll to the top of your source file. If there are no "using System.Net.NetworkInformation;" statement, add the line there.

    If the class still does not show up in Intellisense, now check the "Assembly" information and see if the listed DLL is in your project's reference, and add it if it's not there. Since this class is from System.dll which is included by default for projects, this is unlikely to be required.

    And then if the class does not show up, you'll want to check the version information. Some class are only included for some version of .NET framework and you may want to check and see if it matches. Some class are for WPF only and you can't use it unless you're writing WPF project, or hosting a WPF control inside your WinForm.

    Added to the mix is UWP/Xamarin/.NET Core/.NET standard framework projects, but I'm not going to dive in detail for now to avoid further confusing you.


    Monday, June 19, 2017 1:55 AM
    Answerer
  • Hi Armin.Programmer,

    As cheong00 said this class is from System.dll which is included by default for projects, you don't need to add related reference. Just move your mouse to the code and add related using (System.Net.NetworkInformation).

    For usage of this class. please refer to:

    https://stackoverflow.com/questions/3840195/how-do-i-use-system-net-networkinformation-gatewayipaddressinformation-class

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 19, 2017 5:48 AM
    Moderator