How to be in. NET processing of WMI data

Source: Internet
Author: User
Tags net serialization web services
How to be in. NET processing of WMI data
--------------------------------------------------------------------------------


Learn how to handle a WMI property when it does not match the. NET data type.
by Ken Getz
Note: At the Vbits conference held in San Francisco on February 12 (Wednesday), Ken Getz released a speech with the theme "Fill the gaps with WMI" and "Save yourself with. NET serialization". The skill of this article is chosen from it.

When the WMI property does not match the. NET data type
When the designers of WMI (Windows Management instrumentation) Create their classes, they do not take into account. NET programmer. You will find that many WMI properties do not directly match the. NET data types. For example, although WMI supports unsigned integer types, vb.net does not support it. Sometimes you can use it. NET provides the structure to imitate. In other cases, you need to turn off Option Strict in vb.net to process WMI data. If you find that your code does not run when Option Strict is opened, you can isolate the "fault" code in a separate module, at the top of the module, and set Option Strict to OFF.

Excluding a class member when serializing an object
When serializing an object, serializer saves all the values associated with your object (even private values) in the output stream. Because. NET serializer is designed to allow you to save and restore the entire state of an object or group of objects, so it is critical that serializer save all data (not just public data). If you want to explicitly exclude any class member when serializing an object, add the Nonserializable property to a specific member. (This technique applies only to the SoapFormatter and BinaryFormatter classes--xmlformatter classes do not save private data, because it is intended to serialize data that can be used for XML WEB services. Where private data is not useful. )





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.