My Q Flashcards
Difference between stop and break in parallel.For
Stop, stops straight away, break ensure all previous indexes have been executed
Linq to force sequencial operation
AsSequential()
Thread vs tasks
No continuations, thread can be joined
Threads have priority
Threads are created as foreground process
How to pass params to thread
Create parameterizedthreadstart and pass it to thread constructor or create an action with input lambda
Best practise to stop thread
Use shared variable to be able to clear resources
Best practise for objects usage for lock
Use a new object, using this is bad and string is not recommended as it contains a pool. Of strings
Are subscribed events executed in sequence? Which thread?
Not guaranteed and same publlihser thread and all events will look.
What method is used call all subscribers to event
GetInvocationList
Benefit of static constructir
Load resources, call only once when when the first instance in instantiated.
Extension method override existing methods?
No, the original method will be called.
box vs unbox
Box, value type to reference type, inbox is otherway round
How to check if a class has attribute
Attribute.Isdefined(type class, type attribute)
How to restrict attributes to classes
Use attributeusage attribute on the class of the atrribute
Dispose(bool disposing)
General practise?
Thread and thread pool
Explain
difference between DataContractSerializer vs XmlSerializer
XmlSerializer only serialize public members, DataContract serializer you need to specify attributes and it can handle private members.
Difference between sn, regasm regsvr32 and ildasm
You should run Sn.exe. The Strong Name tool creates a strong name for an assembly, which is required for the assembly to be placed in the GAC. A strong name is a unique name for an assembly. It consists of the assembly name, version, culture, public key, and digital signature.
You should not run Regasm.exe. The Assembly Registration tool registers the assembly as a COM object. This does not prepare an assembly for being placed in the GAC.
You should not run Regsvr32.exe. The Component Registration tool allows you to register an assembly to be used by COM clients. This does not prepare an assembly for being placed in the GAC.
You should not run Ildasm.exe. The MSIL Disassembly tool allows you to access the intermediate language of an assembly. This does not prepare an assembly for being placed in the GAC.
Can you change modifier for explicit implmeneted interfaces like public/private
NO
How to Load Assembly Dynamically
use LoadFrom
How to allow get private methods
Set BindingFlags in GetMetho to nonPublic
DIfference between monitor and lock, interlocked
?
Dispose pattern, Dispose(bool disposing) if disposing true, is it called manually or by Finalizer
Manually
Exporting Assemblies to Com libraries
need to specify ComVisible in Assembly or individual classes
need Assembly: guid to be set
need tlbexport