.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”

C#:- Compiler Error – “The entry point of the program is global code; ignoring ‘Main(string[])’ entry point”

Background Let us go with our old stand by. HelloWorld.   Language Language - C Script Code Output Output Image Using tio.run c / gcc compiler Output - Text   Language - C# C# - Without Class Definition Outline Let us convert our c code to C#. Code Changes Import c:- #include <stdio.h> Include stdio.h … Continue reading C#:- Compiler Error – “The entry point of the program is global code; ignoring ‘Main(string[])’ entry point”

Powershell:- Get Machine Name

Background I needed to confirm a machine name. It is easy to do so via accessing the machine and running a few system commands. But, want to do so programmatically, as well. Choices Here are some of the options for getting a machine name in PowerShell. Get Computer Name Using Environment Variables .Net Class System.Environment … Continue reading Powershell:- Get Machine Name