·
C# 3.0 Refresher
o
Automatic Properties
o
Object Initializers
o
Collection Initializers
o
Extension Methods
o
Anonymous Functions
o
Anonymous Methods
o
Lambda Expressions
·
Visual Studio 2010/2012 New
Features
o
Architecture explorer
o
Dependency graphs
o
Sequence diagram
o
Intellitrace
o
And other new features
·
Managed Extensibility Framework
NOTES
1. Ildsm
a. http://ilspy.net/
2. Ilspy
3. Reflector.exe
vs ildasm
a. http://stackoverflow.com/questions/1503943/how-to-decompile-a-dll-file-created-in-vs-net
4. Static
method vs Extension Method
5. Anonymous
Function is inline delegate // Func and Action
6. Lambda
Exp
a. in C# 3.0 and later, lambda expressions supersede anonymous
methods as the preferred way to write inline code
b. Anonymous methods enable you to omit the parameter list. This
means that an anonymous method can be converted to delegates with a variety of
signatures. This is not possible with lambda expressions.
c.
7. LINQ: 3
ways of using LINQ:
a. Use
enumerable.where, enu.select etc. ie Lambda Expression, using static method
directly
b. Enu.sel(Enu.where
(NESTING)
c. Enu.where.select…
(CHAINING)
d. Using
linq keywords
8. LINQ
gets executed whenever used (deferred ex) and every time it is used,
irrespective of change in parameters. The latter behavior can be overridden by
converting the query result toList etc. and then use that for further execution
9. LINQ
is slower than for and foreach, but useful when using with parallel programming
(asParallel())
10. http://www.linqpad.net/
11. Powerpoint
Storyboarding for Prototyping(http://tfs.visualstudio.com/en-us/learn/storyboard-your-ideas.aspx
) comes with VS premium and up : http://msdn.microsoft.com/en-us/library/vstudio/hh409276.aspx
12. Sequence Dia for any
method BEST
13. 2013 Code Map
14. Architecture tools for
Ultimate Version to create UML, flow etc.
15. VS 2012 code snippet
manager
16. Intellitrace vs and
standalone but can’t debug using windbg or debugDiag
17. Webmatrix for quick creation
of sites etc. http://www.microsoft.com/web/webmatrix/
18. Snippet designer
extension: http://snippetdesigner.codeplex.com/wikipage?title=createFromScratch&referringTitle=Documentation
19. http://stackoverflow.com/questions/100420/hidden-features-of-visual-studio-2005-2010
20. Alt+Shift+F11 for Visual Studio keyboard
scheme for highlighting word wherever its used in file. Better is http://visualstudiogallery.msdn.microsoft.com/8ffec54d-4e18-4c42-ad33-2ea6f28de464
21. Pin data
tips
22. Code Clone analysis in
VS 2012 ultimate to show duplicate code
23. F1 to see docs of
anything from VS2010
24. FxCop : FxCop analyzes the compiled object code, not
the original source code. It
uses CIL parsing, and callgraph analysis
to inspect assemblies for more than 200 different possible coding standards
violations
25. StyleCop is
an open source static
code analysis tool from Microsoft that
checks C# code for conformance to StyleCop’s recommended
coding styles and a subset of Microsoft’s .NET Framework Design Guidelines.
StyleCop analyzes the source code,
allowing it to enforce a different set of rules from FxCop (which,
instead of source code, checks .NET managed code assemblies).
26. Code analysis in VS
2012 (set its rules from solution properties)
27. Code Metrix in VS 2012
28. Lightswitch (for
datacentric apps) vs webmatrix (for cms solutions)
29. How to use lightswitch
with webmatrix
30. MEF: there are
2 ways of adding extensions to the source
a.
var a = new AssemblyCatalog(Assembly.GetExecutingAssembly());
var container = new CompositionContainer(a);
b. var container = new CompositionContainer();
var batch = new CompositionBatch();
batch.AddPart(new CustomExtensionV1()); batch.AddPart(this);
container.Compose(batch);
c. Apart
from this, every MEF needs the source to mark some properties to be importable
by using [Import]:
[Import(typeof(ICustomDataSource))]
public ICustomDataSource DataSource { get; set; }
a. And
lastly there should be properties that the Extensions Export,using [Export],
which will replace the source properties:
[Export]
public ICustomDataSource WriteToConsole
These 4 things are basic to every MEF
implementation. A good eg. Of this is Visual Studio, which exposes properties
as [Import] so that other extensions can then replace those with their own
values and Just Work…without the VS Source Code changing
31. http://msdn.microsoft.com/en-us/library/dn170416.aspx
32. http://msdn.microsoft.com/en-us/library/vstudio/bb397687.aspx
33. http://msdn.microsoft.com/en-us/library/vstudio/bb397951.aspx
34. A function can be
written as anonymous fn, or del
PARALLELISM
1. Cancellationtokensource|:
http://msdn.microsoft.com/en-us/library/vstudio/system.threading.cancellationtokensource(v=vs.100).aspx
2. Map
parallel task window tasks to threads window threads
3. Parallel.ForEach()
4. Exception
with Tasks: http://msdn.microsoft.com/en-us/library/dd537614.aspx
5. Generics
in Tasks
6.
PERFORMANCE
1. Windows
Performance Monitor: perfmon
2. http://bcl.codeplex.com/wikipage?title=PerfMonitor
1. Cmd
line tool
2. perfMonitor
runAnalyse abc.exe
3. Generates
report
3. Windows
Performance Analyser
4. Windows
Performance Recorder or xPerf or perfMonitor to generate etl files to generate
files and then view using Windows Performance Analyser
5. All
above is for Historical Performance but for live, use perfMon.
6. perfView
35. Dispacher…
a. Win
8 has ui, worker and composition thread
36. Code Contracts
37. New Type Lazy
38. Inter Process
Communication using MemoryMappedFile is new in 4.0 createNew to create a
inmemory file and openExisting to read from that file
39.
7. Automatic
Properties
1.
Need: Properties can have code put into them without breaking
contract, fields can’t have code put into them without changing them to
properties (and breaking the interface). Properties can be read only or write
only, fields can’t. Properties can be data bound, fields can’t.
2. publicstringForename{ get;set;}
is same as:
privatestring forename;
public
stringForename
{
get
{
return
this.forename;
}
set
{
this
.forename = value;
}
}
3. They are
implemented differently in the resulting IL code (and machine language). An
Automatic property is still exposed as a public getter and setter, whereas a
public field is just that – a single field..
4.
implementing an auto property allows you at some
later date to change the internal behavior of either the getter or setter (like
adding a validator) without recompiling or recoding any dependant classes that
use it
5.
read: http://www.codinghorror.com/blog/2006/08/properties-vs-public-variables.html
6.
see: http://csharp-video-tutorials.blogspot.in/2012/06/part-26-c-tutorial-why-properties.html
7.
Inheritance and props: http://msdn.microsoft.com/en-us/library/75e8y5dd.aspx
8.
Object
Initializers
9.
Collection
Initializers
10.
Extension
Methods
11.
Anonymous
Functions
12.
Anonymous
Methods
13.
Lambda
Expressions
14.