Background A few weeks ago, I was in a jam. I wanted to draw a line on my console to separate out two sections of output. It seems terrible inefficient to use Write-Output("----------------------------------------"). I preferred something like Write-Output(repeatChars('-', 80)). Code Here is stolen code that I have to come back and properly attribute ( give … Continue reading Powershell:- Repeat Character
.Net ( Microsoft )
Powershell:- Raising an ArgumentException
Background Good software engineers engage in defensive development. As opposed to offensive practices. Code In this post, we will employ .Net's System.ArgumentException to offer examples of how to better help the developer know why an application is failing. Outline Function:- calculatorGraceful If operation is equal and divisor is 0 If exceptionType is 1 throw (New-Object … Continue reading Powershell:- Raising an ArgumentException
.Net:- Operator – The null-conditional operator ?.
Background In this post we will cover the Null-Conditional Operator ( ?. ). Series Here are other posts that covers .Net Operators:- .Net:- Operator – The null-coalescing operator ?? Date Published:- 2022-November-8th Link Code Code - HelloWorld Code - HelloWorld Outline Get String Length Print String and String Length Output Output - Text … Continue reading .Net:- Operator – The null-conditional operator ?.
.Net:- Extension Methods in C#
Background Object Oriented Programming Languages allow various features to add additionally functionality to existing classes. Tooling Here are some of the available faculties:- Inheritance Interfaces Base Class String Class Methods Depending on the programming object certain methods may be exposed. Methods such as:- Length Upper Lower Split Word Count Proper Case Reverse Convert … Continue reading .Net:- Extension Methods in C#
.Net:- C# – Get List of Month Names
Background I found myself developing a small sample code learning LINQ. I wanted to find data based on dates. Rather than to display the month as a number, I opted to display as a name. In essence to be able to hard code the number 3 for the 3rd month, yet "beautifully" display the entry … Continue reading .Net:- C# – Get List of Month Names
.Net:- Operator – The null-coalescing operator ??
Background .Net Console.WriteLine is null safe. But, then some functions may not be. To protect yourself in the case of nullable variables, please consider the use of the ?? operator. Code Output Image Textual References Microsoft Learn > .NET > C# guide > Language reference > Operators and expressions ?? and ??= operators … Continue reading .Net:- Operator – The null-coalescing operator ??
.Net:- Error – ‘System.Data.DataRowCollection’ does not contain a definition for ‘OfType’ and no extension method ‘OfType’ accepting a first argument of type ‘System.Data.DataRowCollection’ could be found
Background Still here trying to steal that same old code. Lineage .Net:- Compile Error – ‘System.Data.DataRow’ does not contain a definition for ‘Field’ and no extension method ‘Field’ accepting a first argument of type ‘System.Data.DataRow’ Link Error Message Textual Image Explanation The error states that The System.Data.DataRowCollection object is missing the Field Property … Continue reading .Net:- Error – ‘System.Data.DataRowCollection’ does not contain a definition for ‘OfType’ and no extension method ‘OfType’ accepting a first argument of type ‘System.Data.DataRowCollection’ could be found
.Net:- Compile Error – ‘System.Data.DataRow’ does not contain a definition for ‘Field’ and no extension method ‘Field’ accepting a first argument of type ‘System.Data.DataRow’
Background Trying to steal someone else's code. But, as sometimes happens, it does not even compile. Error Message Textual Image Explanation The error states that The System.Data.DataRow object is intrinsically missing the Field Property And, that I have not helped to even include an extension method that will provide one Remediation As … Continue reading .Net:- Compile Error – ‘System.Data.DataRow’ does not contain a definition for ‘Field’ and no extension method ‘Field’ accepting a first argument of type ‘System.Data.DataRow’
PowerShell:- Out-GridView -PassThru | Set-Clipboard
Background Yesterday, I found myself struggling with a database project. I thought let me capture some metadata, view it in a grid view and I will have more to go with. Clipboard Captured the data into a data table, pipelined it into GridView. Got a good thing going. As always got greedy. Thought to … Continue reading PowerShell:- Out-GridView -PassThru | Set-Clipboard
.Net – ASPX – Error – “Invalid postback or callback argument. Event validation is enabled”
Background Tried using a dated .Net Application that I wrote quite a long time ago. I accessed a drop down, selected an item from the drop down, and clicked a push button. Errors Error - "Invalid postback or callback argument. Event validation is enabled using..." Unfortunately received an error that reads:- Text Invalid postback or … Continue reading .Net – ASPX – Error – “Invalid postback or callback argument. Event validation is enabled”
You must be logged in to post a comment.