[Learn notes] Several questions encountered by C #

xiaoxiao2021-03-06  70

1. I don't know why, the installed Visual Studio seems to be unsatisfactory, and some of the methods of some data types is actually no!

such as:

INT MyNumber = int32.fromstring (s);

Note: f: My Documentsvisual Studio ProjectSexam3_5class1.cs (28): "int" does not include the definition of "fomstring"

(This problem has been resolved: change to int myNumber = int32.parse (s); or int myNumber = convert.toint32 (s);)

Stream s = (New File ("LinkedList.bin"). (Filemode.open);

Report: f: My Documentsvisual Studio ProjectSexam2_16Class1.cs (51): Overload "Open" method does not get "1" parameters

2, when you look predefined, there is a place to see,

The book says:

Predefined declaration statement #define can not directly follow the actual code, but you can directly contact other preprocessing statements, such as the following statement is correct:

#define a

#if a

#define b

#ENDIF

Namespace Exam3_6

{

Using system;

#if B

Public Class Class 1 {}

#ENDIF

}

But the following statement is wrong:

#define a

Namespace Exam3_6

{

#define b

#if B

Public class clas1 {}

#ENDIF

}

Compile it in the compiler, report an error in the line of #define b:

F: My Documentsvisual Studio ProjectSexam3_6class1.cs (4): You cannot define or unfained the pre-processor symbol after the first tag of the file.

But I still don't understand, where is it wrong?

转载请注明原文地址:https://www.9cbs.com/read-108458.html

New Post(0)