My Q Flashcards

1
Q

Difference between stop and break in parallel.For

A

Stop, stops straight away, break ensure all previous indexes have been executed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Linq to force sequencial operation

A

AsSequential()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Thread vs tasks

A

No continuations, thread can be joined
Threads have priority
Threads are created as foreground process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to pass params to thread

A

Create parameterizedthreadstart and pass it to thread constructor or create an action with input lambda

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Best practise to stop thread

A

Use shared variable to be able to clear resources

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Best practise for objects usage for lock

A

Use a new object, using this is bad and string is not recommended as it contains a pool. Of strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Are subscribed events executed in sequence? Which thread?

A

Not guaranteed and same publlihser thread and all events will look.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What method is used call all subscribers to event

A

GetInvocationList

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Benefit of static constructir

A

Load resources, call only once when when the first instance in instantiated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Extension method override existing methods?

A

No, the original method will be called.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

box vs unbox

A

Box, value type to reference type, inbox is otherway round

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How to check if a class has attribute

A

Attribute.Isdefined(type class, type attribute)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to restrict attributes to classes

A

Use attributeusage attribute on the class of the atrribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Dispose(bool disposing)

A

General practise?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Thread and thread pool

A

Explain

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

difference between DataContractSerializer vs XmlSerializer

A

XmlSerializer only serialize public members, DataContract serializer you need to specify attributes and it can handle private members.

17
Q

Difference between sn, regasm regsvr32 and ildasm

A

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.

18
Q

Can you change modifier for explicit implmeneted interfaces like public/private

A

NO

19
Q

How to Load Assembly Dynamically

A

use LoadFrom

20
Q

How to allow get private methods

A

Set BindingFlags in GetMetho to nonPublic

21
Q

DIfference between monitor and lock, interlocked

A

?

22
Q

Dispose pattern, Dispose(bool disposing) if disposing true, is it called manually or by Finalizer

A

Manually

23
Q

Exporting Assemblies to Com libraries

A

need to specify ComVisible in Assembly or individual classes
need Assembly: guid to be set
need tlbexport