CSharp Trap 1, csharp trap

Source: Internet
Author: User

CSharp Trap 1, csharp trap

CSharp Trap 1

Environment: sharpdevelop 3
. Net 2.0

Correct
Internal static readonly string [] string_2 = new string [] {"A", "B "};
Internal static readonly ArrayList arrayList_0 = new ArrayList (string_2 );


Which of the following is incorrect?

Internal static readonly ArrayList arrayList_0 = new ArrayList (string_2 );
Internal static readonly string [] string_2 = new string [] {"A", "B "};

Can be compiled.



Csharp Problems

It is best to use if-else. Change it by yourself.
You can check the information on your own.

Namespace _ 1a
{
Class Program
{
Static void Main (string [] args)
{
Console. WriteLine ("enter" 1 ", Press enter to input data \ r \ n enter" 2 ", Press enter to display data ");
Console. WriteLine ("enter" 3 ", Press enter to sort data \ r \ n enter" 4 ", Press enter to exit the system ");

Int max = 6; // The maximum number of arrays that can be stored
Int real = 0; // The number of actually stored instances.
Int [] nums = new int [max];

While (true)
{
String choiceInt = Console. ReadLine ();
Switch (choiceInt)
{
Case "1 ":
Nums = new int [max]; // when you press 1 again, save the new data.
Console. WriteLine ("enter a series of numbers :");
While (true)
{
String num = Console. ReadLine ();
Int temp = 0;
If (int. TryParse (num, out temp ))
{
// If the input is 2, sort the entered numbers.
If (temp = 2)
{
Goto case "2"; // goto is not safe and is not recommended
}
Else if (temp = 3)
{
Goto case "3"; // goto is not safe and is not recommended
}
... The remaining full text>
Deng Quan [authoritative expert]

C ++ converts C #

You can use the reflect tool as long as the. net code can be converted to each other. My machine does not have C ++. Download a conversion by yourself.

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.