For your own use .. Porting from C # to Java

Source: Internet
Author: User
Tags array definition

Two-dimensional array definition C #: [,] Java [] []

Two-dimensional array length C # One-Dimensional. getlength (0), two-dimensional. getlength (1)

Which of the following filter conditions can be used in C "? The name does not seem to be correct. For example, calcasynclist. foreach (OBJ => obj. Stop ())

"OBJ => obj. Stop ()" is the filtering condition. The foreach method traverses the list and returns the List member (that is, "OBJ ",

(Other names can be written as needed, such as Nima => Nima. Stop () Call the stop function.

In Java, it seems that you can only write traversal by yourself.

In C #, You can initialize the list using the following methods:

List <mypoint> List = new list <mypoint> {New mypoint (), new mypoint (), new mypoint )};

Java seems to be able to use the double braces"

List <mypoint> List = new list <mypoint> () {Add (New mypoint (0, 0); add (New mypoint (1, 0 )); add (New mypoint (2, 0) ;}// not compiled

C # inherit from: icomparable equivalent to Java implements comparable <mypoint>

(This method is used to specially compare the list and hashmap methods of such classes after they are constructed. This is often necessary)

C #'s "filter condition" makes the transplant suffer. Pay attention to multiple conditions, such:

"Condition 1" & "condition 2" & "Condition 3" & "Condition 4"

Change to embedded judgment,An error occurs!

Before modification, list all possible conditions and add the remaining conditions after modification to nesting!

C # "value transfer call", address transfer call, and "reference transfer"

In Java, a common variable is a value-passing call, and a class is a reference call.

C # ApplicationProgramError: "Yes"Skipping targetGeneratetargetframeworkmonikerattributeBecause all output files are up-to-date with input files...", In fact, we should first look at the error message in the first line of the log.

C # When Using sorteddictionary

Treemap should be used for corresponding Java, but note that if the key is of a custom type and its comparison function does not compare the size with other keys, an error is required,

Because the compare method is used as described in the treemap source code, the same elements cannot be compared When you constantly search for the branches.

(But C # is okay .. Maybe other comparison functions, such as equal, are used)

Supplement later

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.