C # 鲜 快 报 FAQ20

zhaozj2021-02-08  465

A few weeks ago, Microsoft officially issued a C # language in June 2000, which has officially released a C # language, and has opened a new sector in emerging senior languages. Regarding this new language, there are many many rumors, and many netizens are eager to understand it. In this regard, the Senior Programmer Jeffrey of Microsoft General Runbure Development Team accepts questions from netizens and answers one by one. The following is related. NET and C # language quantitative quantities.

Q1. Q: I haven't figured it out for so long,. Net is the running library or the development platform?

A: Both! And still don't stop these - Microsoft's grand goal is to let Microsoft.net thoroughly change software development, release methods, use methods, etc., and more than one for Microsoft, but to all companies! The ".NET architecture" package, ". NET architecture" is the first part of the Microsoft.net program, which includes two components: "NET universal runtime" and " .NET class library. Recently, good news said that the two components have been packaged in ".NET architecture SDK", put them on Microsoft's station for free for everyone to download, interested friends must try it! In addition, this SDK also includes a command line compiler of C #, C , JavaScript, and VB. Use these compilers to develop applications and components. From this perspective, .NET architecture first is a development platform because it Provide run libraries and class libraries, and, the next is about Visual Studio.NET, including more comprehensive SDK and graphical development interfaces, wizards, tools, etc., more like a development platform. However, the .NET running library has actually been integrated into the operating system, so it is also possible to run the run.

Q2. Q: How big is the possibility of c # becomes a versatile language? I mean, not only a language that Microsoft supports. Also, if this is true, have other software companies commit to providing a C # compiler on a non-Windows platform?

A: This problem is now answering a little fashion. Anyway, I just like to use C # to program! (Dizzy ...) Because it is very similar to C , I learned how much time. Microsoft has now submitted C # to the ECMA standardization organization, and if any company can develop a C # compiler. However, the original purpose of designing C # language is to make it completely dependent and is fully compatible with the language of the universal language logo. There is no support for the run. C # is so powerful. It is easy to develop a compiler on other platforms, but transplantation runs is a big project.

Q3. Q: Can you talk about what specific questions in C # are advantageous than Java?

A: Although everyone is very sincere, I still want to tell you: I have never learned Java! However, I don't wish to talk about the difference between C # and C : C # has a simpler grammar, closely integrated components and functions, type security, etc. If you want to know the difference between C # and Java - ask other people, don't ask me.

Q4. Q: Is it the best and most effective way to access the database in the C # language? Or do you have a better OLEDB API package function in the C # running library?

A: The .NET class library includes a name space called System.Data, which has a lot of access to the database. C # programmers can easily use these classes to access the database and do not need to use ADO . Q5. Q: Can C # can develop Windows programs? Can I only develop distributed applications?

A: Of course! C # can develop any classic style Windows program. Not only that, whether it is a control program, graphics, NT service, or normal components, or even web pages, in addition to hardware drivers, can be developed with C #. In fact, these functions are implemented from the running library, and the C # language itself does not provide.

Q6. Q: What is the relationship between C # and WinForms?

A: WinForms is the class set in the .NET class library, which encapsulates Windows, Brushes, and Pens classes in the Win32 class. Any language that uses the run library (including C #) can establish instances of these classes and control. As far as I know, WFC class libraries for WinForms and J have some places.

Q7. Q: Rumor C # has been submitted to the ECMA Standardization Organization waiting for approval, is it?

answer! Go to Q2 to see it.

Q8. Q: What role will ATL and COM play in .NET new technologies?

A: The .NET architecture replaced a lot of old technologies, like ATL, MFC, C Runture, Standard Template (STL), etc., no longer appeared. .NET uniforms the program class library, develops more than using these old technologies. I guess a lot of programmers to see these advantages of .NET will choose to leave old technologies without returning. However, the old girl has a certain advantage: its performance is relatively better. If you need special highlight performance, you can still continue to play with these old stations. In addition, for COM, components develop the same function with .NET will be more than a few quantities than before, and can easily get interoperability requirements between individual components. Currently, COM and trading services cannot be used directly in .NET code, it can be used by indirect methods, but only in performance.

Q9. Q: Why is C # not as a template function like C ?

A: Ah ... ah ... come again, then say it again, the template should actually be the function provided by the running library, not related to the C # language. There is no two reasons for the Template function in C #. First, the implementation template has certain difficulties, so Microsoft is not intended to provide such functions in the first edition of the C #, and there are similar functions in the later versions. Second, because the runtime that supports multi-language runtime (not just C #), if you introduce a template in the running library, it means that all languages ​​that use this runtime must support template function, at this point Microsoft has to consider carefully, so don't intend to add templates now.

Q10. Q: Will you change the pseudo-key that makes ATL and COM in a false keyword? What is ole_color, bool, variant_bool, dispid_xxxxx, annoying.

A: You can rest assured, absolutely change! Each type has a new name in the .NET class library.

Q11. Q: We now have seen the extension and improvement of restrictions, in addition to this, how will the status of C in MS or .NET will?

A: C language is the most unique in various languages ​​of Microsoft, and it is the only language that can allow programmers to develop unrestricted low-level programs. So, we can often see the programmers with a high unrestricted algorithm code with C write performance, and also write a restricted component code with a limited security level with C . I think Microsoft will continue to retain the current status of C and maintain a long period of time. After all, the driver needs it, and the foundation of Windows is also it, and many products use it. Q12. Q: Since .NET supports ActiveX / COM, how can I guarantee a security of the C # program running in the browser?

A: The .NET runtuant provides code access security features, which allows administrators and users to configure security levels based on the ID ID. By default, the code downloaded from Internet and intranet does not allow access to any local files and resources. For example, I wrote a program to put it on the network, then let it run in the shared directory on the web, if it is going to access some of my local resources, then it will be ruthlessly throwing out, huh, Of course, everything is normal if you are copying to your local hard drive.

Q13. Q: There is a C # program on my machine, then I don't need to install the .NET runtime to run it?

answer. All restrictions require a management program to limit them; here, the run library is the management program. Microsoft will pack the run library free of charge, and the end user must install the entire .NET SDK package from the MSDN to run C #.

Q14. Q: Some people have mentioned that the C # class can derive it from the class declared in VB. Is it true? Where do you have such an example program?

A: It is really true. In fact, as long as it is a language to use the run library, you can declare a class in a language, and a class is sent in another language. Moreover, Visual Studio's debugger will fully support cross-language program debugging, which will display the functions in the stack in each entry in the function stack debug window and what language is written separately; in addition, you can even Expertment errors in the process in cross-language. This feature is really great. When this feature is present, everyone warmly caught the palm. There is an example in the .NET's SDK to demonstrate its practice, it is very simple.

Q15. Q: Can I have a C class to give C # class from the C class? What can you do?

A: The above mentioned, if you use a restriction language, you can naturally, but if you use the unlimited part of C , you can't.

Q16. Q: Can the new version of MFC can choose to run in a restriction environment?

A: I don't pay attention to MFC, but I can confirm that the answer is negative. MFC has never been limited. For restrictions, you should use WinForms to manage.

Q17. Q: If the new version of MFC can run in a limited environment, is it possible to establish Win32 desktop app without the need for .NET runtime?

A: I dare to affirm the MFC can't be like this, and it never needs to run the library.

Q18. Q: Some people say "C # is just Microsoft Windows another unique language, and other platforms cannot be used", do you agree with this?

A: C # is developed for "General Language Runture" (CLR) instead of Windows. If the runtime is ported to other systems, then C # can also be transplanted there. Q19. Q: The rumor can establish a static link of the running library like MFC, is it true? If it is true, the C # is you can create a program that can be run alone?

A: Absolute falsehood. No language can create a static link of the running library.

Q20. Q: Is C # use a resource file? If this is not this, what mechanism does it make user custom programs?

A: The .NET architecture designer uses a new resource model. Resource data can be embedded in an EXE or DLL file like Win23, or in the form of a separate file, such as a BMP or JPG picture. Limited to the space, it will not be described again here.

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

New Post(0)