using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. The Text;
Using System. The Threading. The Tasks;
The namespace ConsoleApp1
{
The class MyArray on
{
Public int no;
Public string [] Numbers;
Public string [and] names;
Public string [] [] scores;
Public MyArray on ()
{
This. No=0;
}
Public MyArray on (string [] Numbers)
{
This. No=1;
This. Numbers=Numbers;
}
Public MyArray on (string [and] names)
{
This. No=2;
This. Names=names;
}
Public MyArray on (string [] [] scores)
{
This. No=3;
This. Scores=scores;
}
Void FromKeyToValue (string key)
{
Dictionary
String [] mf3.
String [and] siblings;
String [] [] renyudi;
MyArray on v1=Dic [key];
Int No=v1. No;
The switch (No)
{
Case 1:
{foreach (string I mf3 in) System. The Console. WriteLine (I); }
break;
Case 2:
The foreach (string I in siblings) {Console. Write (" {0} ", I); }
break;
Case 3:
The foreach (string [] I in renyudi)
{
The foreach (string j in I)
{
Console. WriteLine (j);
}
}
break;
Default:
Console. WriteLine (" error!" );
break;
}
}
Class Program
{
The static void Main (string [] args)
{
Dictionary
String [] mf3={" c ", "c + +", "c #"};
MyArray on myArray1=new MyArray on (mf3);
Dic. The Add (" zhao ", myArray1);
Siblings, string []=new string [and] {{" Mike ", "Amy"}, {" Mary ", "Albert"}};
MyArray on myArray2=new MyArray on (siblings);
Dic. The Add (" money ", myArray2);
String [] [] renyudi=new string [2] [] {new string [] {" Mike ", "Amy", "Albert}", new string [] {" Beijing ", "Shanghai", "Tianjin", "through", "Xiamen"}};
MyArray on myArray3=new MyArray on (renyudi);
Dic. The Add (" sun ", myArray3);
MyArray on. FromKeyToValue (" money ");
}
}
}
}
Severity code shows the project file line prohibits display status
Mistakes CS0165 USES the assignment of the local variable "mf3 ConsoleApp1" E: \ Hashmap \ custom function \ ConsoleApp1 \ ConsoleApp1 \ Program cs 56 activity
Severity code shows the project file line prohibits display status
Mistakes CS0165 USES the assignment of the local variable "siblings" ConsoleApp1 E: \ Hashmap \ custom function \ ConsoleApp1 \ ConsoleApp1 \ Program cs 60 activity
Severity code shows the project file line prohibits display status
Mistakes CS0165 USES the assignment of the local variable "renyudi ConsoleApp1" E: \ Hashmap \ custom function \ ConsoleApp1 \ ConsoleApp1 \ Program cs 64 activity
Severity code shows the project file line prohibits display status
Error CS0120 object references for non-static fields, methods, or properties "MyArray on. FromKeyToValue (string)" is the necessary ConsoleApp1 E: \ Hashmap \ custom function \ ConsoleApp1 \ ConsoleApp1 \ Program cs 102 activity
CodePudding user response:
Void FromKeyToValue (string key){
Dictionary
string [] mf3;
string [and] siblings;
String [] [] renyudi;
See yourself, Microsoft did not wronged you