C #~ Use FileSystemWatcher to monitor File System Changes

Source: Internet
Author: User

For a folder change, C # has its own class to implement it. We do not need to care about its internal implementation mechanism, or what APIs it calls at the underlying layer, we only need to care about how to call it and how to make it help us record the modification of folders.

Monitoring folder changes === policyfilters. lastWrite | watcher. changed + = (source, FileSystemEventArgs e) => + = (source, RenamedEventArgs e) => watcher. enableRaisingEvents =

In addition, we can tell you how to use xor exclusive or operations, that is, it can alternate the values of two variables without introducing the third variable. Your variable can be a numerical value, it can also be a character. If it is a character, we need to use its hashcode value for xor operations.

                     int a = 2;
            int b = 3;
            Console.WriteLine("a={0}", a);
            Console.WriteLine("b={0}", b);
            a = a ^ b ^ (b = a);
            Console.WriteLine("a={0}", a);
            Console.WriteLine("b={0}", b);
            #endregion

Result

Related Article

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.