Tju_scs_c# Study notes (5)

Source: Internet
Author: User

I. Classroom content

The first continuation of the last class, and also about the content of regular expressions, as well as C # exceptions related knowledge, and delegates Chinese translation as a delegate, and C # time events, there are two of Windows Phone app development video tutorials. The regular expression does not have to say, this light is to go out is a worthy of the course, about the events thread ah what, whether in C + + or Java is a headache for my content, about the Windows Phone app development can only say very interesting, But feel still hands-on practice will learn faster, but my virtual machine is not good, still in the solution of the problem ...

Two. Learning content

I will be the teacher in class to us left four blog content for the relevant content of the study. As follows.

The related usage of the 1.Regex class.

To first use the Regex class (the Regex is the abbreviation for regular expression), declare the namespace first:

The following are the basic uses of several regex classes:

Here is the static method of the Regex, and of course there are examples of methods

Here is a simple way to find matching characters in a string, using the IsMatch method.

And also:

The Replace method here is to find the target part in the string and replace it.

The next step is a little more difficult:

This is done by using regular expressions to repeat words in the lookup string. There are a lot of things that I don't understand, like the regular expression itself, which is the part of the quotes behind the @, not understanding,

These are some of the simpler meta characters.

There are also matchcollection,groupcollection, and group["word", this ... Don't understand ... The specific difference usage is not quite clear. is probably the matching string to be stored as matchcollection, and then use GroupCollection to represent each group of specific internal, each match content?

And this, it's a good look:

Forget it = =

The following example:

As to why there is no string in the result, I can understand that there is no space behind the string and does not conform to the description of the regular expression?

2. The question of the categorization of ip,mailaddress,website,time from meta-data. PPT gave an example of the acquisition of Site,time,ip, I would like to add a MailAddress mailbox to get the way, as follows:

Then I feel that everything is messed up, about the mailaddress judgment way of the regular expression is I find on the Internet, there are many expressions on the Internet, it should be reasonable, and then I do not understand is how to do group["time" or something like that???

At first I thought it was this:

Imitate the other three added?<mailaddress> thought to be a regular expression named ... Then the wrong ...

3. Then the async await keyword.

Let's put a little bit of what I found:

Since there are so many things about these two keywords, it's hard for me to understand them. In short, async await is a keyword added to the c#5.0 to implement asynchronous tasks, and this asynchronous task is not really an asynchronous thread or anything, she's a bit like a database search, and when you use it, he will start it ...

Then there are the following examples:

Note here that the last line of code in the main function in the above code is console.readline (); It is important that there will be no asynchronous execution of 2, 3, 4 ... because the main function is not executed until the asynchronous task finishes, so wait, This can help to understand the two tasks that you want to parallel, asynchronous execution, do not need to wait to proceed sequentially, so there will be no lag and so on.

This is just async,await very very simple usage, just fur ...

4. About Tryparse,parse.

This occurs when variables are variable type conversions, and TryParse is obviously a try more than parse, and it gets different results.

As explained above, I feel it is relatively easy to understand.

5. In addition, I have done a little exercise on the content of delegates, delegates is a pointer to a function similar to other languages, the function is more powerful.

Some examples have been found online, as follows:

In the above example, using Delegatemethod, this pointer points to three simple functions, through the pointer to access the calling function method, you can directly use the + = operator, more peculiar.

Three. After-school impressions

More and more difficult, more and more complex AH ah ah ah ah!

Go ahead!

Tju_scs_c# Study notes (5)

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.