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