. NET Basics (vi)

Source: Internet
Author: User

1. Is it possible to make a call to a non-static method from within a static method?
Answer: No. Because a non-static method is associated with an object, you must create an object before you can make a method call on the object, and the static method call does not need to create the object, which can be called directly.
That is, when a static method is called, there may not be any instance objects created, and if a static method is called from a static method, the non-static method does not have an associated object, so it cannot.

2, say some common classes, interfaces, please list 5.
Answer: Class: StreamReader, StringBuilder, SqlConnection, FileStream, File, Regex
Interfaces: IDisposable, IEnumerable, IComparable, ICollection, IList

3. Does C # support multiple inheritance?
A: Support between the classes is not supported, between interfaces.
A class-to-interface is called an implementation, not an inheritance.
The class is Father, interface is ability, ability can have multiple, but can not have multiple father.

4. Simple explanation of the advantages and disadvantages of database indexing.
A: Advantages, using an index can speed up the data query.
Disadvantage, the index is indexed during data insertion, so it can slow down data insertions, updates, and disk usage.
If a table query can be indexed more frequently than writes, indexing is not recommended if the write is more frequent than the query.

5. Why does SQL injection vulnerability occur? How to Prevent.
A: The program development process is not aware of writing SQL statements and filtering special characters, resulting in the client can submit some SQL statements to execute normally.
1. SQL statements try not to omit quotation marks and single quotes.
2. Filter out some keywords in the SQL statement.
3, control error messages, do not output error messages on the browser.
4, use the SqlParameter class, try not to stitch string SQL statements.

. NET Basics (vi)

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.