Category: .NET
-
spot errors in VB
Please spot the errors in the following code in VB.NET: Dim Diff As String = con.ExecuteCommand(“SELECT DATEDIFF(Day,(select [date] from table where Username = ‘” + txtUserName.Text + “‘),’” & DateTime.Now.ToString() & “‘)”) If (Diff > 30) Then Response.Redirect(“PleaseChangeMyPassword.aspx”) End If ( find at least 3…) Side note: No wonder Visual Basic has died (…
-
Generating Visual Studio solution( or project) references
A Visual Studio pacakge is a plugin of Visual Studio that can do (almost) anything inside Visual Studio I have made a small project that generates a list of all solution ( or project) references from VS: You can find the solution at https://github.com/ignatandrei/ToolsAndUtilities/tree/master/VS2015/FindReferencesVS Also the video is at https://youtu.be/a3YHVjJ9fm4 Enjoy!
-
Thank you for all the API
In our days it is simpler to make an application by putting together some API . I wanted to make a list of all my 5 Minutes .NET playlist videos . First,I have tried to find an application(nothing). Then I have read You Tube API from https://console.developers.google.com/apis/library . With 2 http requests( one for retrieving…
-
IDisposable and Marshal.ReleaseCOMObject and dynamic in C#
If you have worked with COM,you know that for every COM object that you access is not only necessary to null the reference,but also call Marshall.ReleaseCOMObject . This is a very error prone task,because you have all try / finally blocks All of this could be done easy with IDisposable,if 1. IDisposable calls the…
-
AppContext
AppContext is like Application in ASP.NET (MVC). You can see the value all over the application And we can have the result in all dll’s by Video demo at https://youtu.be/GMgn4o3yPqw
-
Instrumentation in C# / .NET
For many programmers a try/catch with stack trace it is enough Others want to see also functions arguments,like in will produce the result ERROR An exception occured in method InstrumentationPostSharp.Person.Drink with (beersNumber = 10,vodkaNumber = 2) For this you can install the package https://www.nuget.org/packages/LoggerAspect.Nlog that have full source code at https://github.com/vnvizitiu/AOP/tree/master/PostSharpTutorial and watch my video…
-
RavenDB embedabble
I have made an application with RavenDB embeddable. The good part is that is embeddable and easy to work with – at least,at start. What I have learned: If you forgot to use using,then RavenDB will throw an exception complaining about multiple sessions. Code: If you use multiple instance of the same EmbeddableDocumentStore,even on…
-
Export to Excel,Word,Pdf,Html,CSV
I have made an application / package that exports data ( classes/datatable/csv/json) to Word/Excel/PDF. I have made several tries in the past,however now is the definitive source for .NET 4.x It is FULL code source,with tests and tutorials.. The code is at https://github.com/ignatandrei/Exporter The NuGet package is at https://www.nuget.org/packages/ExporterWordExcelPDF The demo online is at…
-
Throw versus ThrowEx
When you intercept exceptions( for logging ) you can or The difference is small – but the consequences are losing the original stack trace,if you I have done a small video about this : https://youtu.be/Deigld3Bqko I have not covered ExceptionDispatchInfo that you can see an usage here: http://blogs.microsoft.co.il/sasha/2011/10/19/capture-transfer-and-rethrow-exceptions-with-exceptiondispatchinfo-net-45/
-
Useful Attributes in Visual Studio
For me,I like and The code is the following: and the video is at https://youtu.be/ShBr1GgpZKs