. Net interview questions (Advanced Developer)

Source: Internet
Author: User

1) datetime. parse (mystring); this lineCodeWhat's the problem?

A problem occurs. If mystring does not meet the time format requirements, an exception is thrown. datetime. tryparse () is recommended ()

2) What is PDB? Where should it be placed during debugging?

PDB is a file used to save debugging and project status information. It will generate PDB files during debugging and should be placed in the corresponding application during debugging.ProgramSet to the same directory.

3) What is cyclomatic complexity )? Why is it important?

I don't know. Could you please advise?

4) Write a standard lock () and create a critical section before and after the access variable. There must be a "double check ",
 

Use of lock
Public void locktest ()
{
Object lockobj = new object ();
Lock (lockobj)
{
//
}
}

5) What is fulltrust? Is the Assembly placed in GAC fulltrust?

Fulltrust is fully trusted. Whether or not the Assembly in GAC is fulltrust. I understand that fulltrust can be set through code.

6) What are the benefits of adding security permissions to the code?

You can set code access permissions more flexibly to implement code-level protection .? This is not very clear. I want to explain it clearly.

7) What is the role of the gacutil/L | find/I "corillian" command?

The Global Assembly Cache updates the Assembly if corillian exists.

8) Why is the command Sn-T Foo. dll?

Display the Public Key mark of the Assembly Foo. dll

9) What ports does DCOM need to open through the firewall? What is port 135 used?

Port 135, because the DCOM port number is randomly allocated, by default, more than 1024 of the port number is allocated, so by default, DCOM cannot cross the firewall. Because you do not know which port to open. But there is a solution that can fix the port number assigned by DCOM, and I have some descriptions about the content in http://www.cnblogs.com/jillzhang/archive/2008/02/20/1075057.html. 135 is the default port for Remote Procedure Call (RPC)

10) What are their purposes for comparing OOP and SOA?

I think OOP and SOA should have no contrast. Oop is a programming model that breaks down complex logic into small modules, featuring inheritance, encapsulation, and polymorphism. SOA is a technical framework, and the technical framework and programming model should be said to be different? The idea of SOA is to encapsulate business logic into services or middleware for application calls. Of course, its componentization idea inherits and carries forward the advantages of OOP.

11) How does xmlserializer work? What ACL permissions does a process using this class need?

I only know that xmlserializer serializes and deserializes the attributes and fields of an object, serializes the object into XML data, deserializes the object, and converts the XML into an object. At least the read permission in the ACL permission should be required.

12) Why does not catch (exception) be promoted )?

There may be two possible causes: 1) Try .. catch affects performance when exceptions occur. 2) Capture more specific exceptions, such as ioexeception and outofmemoryexception.

13) What are the differences between Debug. Write and trace. Write? Which one should I use?

Debug. Write outputs information to the tracing window during debugging. It is valid only when the compilation mode is Debug. It is debug when the release mode is used. write will be ignored during compilation, while trace can output information to the tracing window in both Debug and release modes.

14) Is there a significant speed change between debug build and release build? Describe the reason.

Debug will generate a PDB file, but release will not. Debug is used for debugging during development and cannot be used for deployment. Release is used to deploy. Debug to compile some special code, such as # ifdebug debug Debug. Write. Release will omit the special labels.

15) Does JIT occur in the unit of assembly or in the unit of method? What is the impact on the workspace?

Method, the principle is very simple, because for a single run, it is likely to only use a very small number of types and objects in a program set, and most of them may not be used, at this time, the CLR is dumbly giving compile to the entire assembly. Isn't the CLR crazy?

16) Comparison of abstract base classes and interfaces

Abstract classes can be implemented in a specific way, while interfaces only define behavior norms and cannot be implemented in a specific way. A class can inherit only one parent class, but can implement multiple interfaces.

17) is a. Equals (B) the same as a = B?

Different. A. Equals (B) indicates that a is consistent with B, and a = B indicates that A is equal to B.

18) in object comparison, what are the meanings of the same object and the same object?

Object consistency means that two objects are the same object and the reference is the same. The same object means the two objects have the same value, but the references are not necessarily the same.

19) how to implement deep copy in. Net )?

Implement the iclonable Interface

20) Please explain iclonable

The iclonable method is an interface for implementing deep replication, which should be able to replicate an object in depth. Features of deep replication call the object construction method to create new objects, including creating new instances of nested referenced objects in objects. Shadow replication is different. It is a superficial replication, and no new instances are created. The implementation of superficial replication is object. memberwiseclone ().

 

Comparison between deep copy and Shadow Copy
Public Class Name
{
Public String firstname;
Public String lastname;
}
Public class person: icloneable
{
Public name personname;
Public String email;
/** // <Summary>
/// Example of deep copy
/// </Summary>
/// <Returns> </returns>
Public object clone ()
{
Person P = new person ();
P. Email = This. Email;<p>_ ICMs</p> <br>
P. personname = new name ();
P. personname. firstname = This. personname. firstname;
P. personname. lastname = This. personname. lastname;
Return P;
}

Public void changlastname (string lastname)
{
This. personname. lastname = lastname;
}

Public static void main ()
{
Person P = new person ();
P. personname = new name ();
P. personname. lastname = "Jill ";
P. personname. firstname = "Zhang ";
P. Email = "jillzhang@126.com ";
Person samenameperson = P. Clone () as person;
Samenameperson. changlastname ("CLR _");
Console. writeline (P. personname. lastname );
Console. writeline (samenameperson. personname. lastname );

Person sameperson = P. memberwiseclone () as person;
Sameperson. changlastname ("shadow ");

Console. writeline (P. personname. lastname );
Console. writeline (samenameperson. personname. lastname );

Console. Read ();
}
}
 

21) What is packing?

Boxing converts data of the value type to the reference type. Int I = 3; object o = I; is the packing process, while unboxing) is to convert the drinking type data to the value type, such as Int J = (INT) O; belongs to the unpacking

22) is string a value type or a reference type?

Reference Type

23) What are the advantages of the attribute-oriented mode used by xmlserializer? What problems have been solved?

Only serialize useful data, rather than serialize the entire object. Implement unnecessary data redundancy and improve serialization performance.

24) Why shouldn't the out parameter be used in. Net? Is it good?

I like to use the out parameter, especially when the function requires more than one response, I prefer to use the out parameter. Have you studied it?

25) can features be placed on the parameters of a method? If yes, what is the purpose?

Yes. The function can further limit the parameters. For example, if the input parameter is of the int type, you can limit the size of the input parameter by allowing attributetargets = parameterinfo's custom attribute implementation, for example, if the input parameter is less than 100, an error occurs.

Example of setting attribute for method parameters
[Attributeusage (attributetargets. Parameter)]
Public class parameteratt: attribute
{
Public int min = 100;
}

Public class attributetest
{
Public void testmethod ([parameteratt (min = 100)] int par1)
{
Parameterinfo para = methodinfo. getcurrentmethod (). getparameters () [0];
Parameteratt = parameteratt. getcustomattriatt (para, typeof (parameteratt) as parameteratt;
If (Att. min> par1)
{
Throw new exception ("The minimum para1 required is" + Att. min );
}
}
}

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.