C# Archives

Null Object Pattern in C#

Author - Webner
|
0 Comments
|

The null object pattern is designed to handle the null exception of objects without implementing too many null checks in the application. This is done by identifying the behaviour that should occur when a null is encountered and declaring a default object for that instance that should be passed when Read more…

Code Optimization in C#

Author - Webner
|
0 Comments
|

What is Optimization?

The word Optimization is derived from the Latin word Optimal which means the best. Optimization is a methodology of making a system or decision fully perfect, functional, and effective.

Now, what is code Optimization?

In terms of code, Optimization is the process of Read more…

How to remove a property from Json in C#

Author - Webner
|
0 Comments
|

Description: Suppose we have the following JSON data and we want to remove the property “RunIsolated” (highlighted) under the compositeRequest to get the final JSON without this property:

Solution for Json:

Following is the sample code to achieve this:
string jsonContent = “{\”allOrNone Read more…

Dependency Injection in C Sharp

Author - Webner
|
0 Comments
|

To understand the term Dependency Injection, we must know what is Dependency and IoC?
In terms of Object-Oriented Programming, Suppose Class A uses Class B for one of its jobs. Here Class B is a dependency of Class A and Class A is dependent Read more…

How to get Attachments from Salesforce using API in C#

Author - Webner
|
0 Comments
|

Description: The code below shows how we can get Salesforce attachments from various objects and save them to a particular folder on a local disk. This is the complete code to get all attachments saved in all Contact objects in Salesforce.

string _baseFolderPath = “C:\Users\username\Desktop\SFAttachments Read more…

Diagnostics in the C# Programming

Author - Webner
|
0 Comments
|

The System. Diagnostics namespace provides a process class which has some method to run external .exe or another application into a C#.

This also enables you to debug and trace code; start, stop, and kill processes; monitor system performance; and read and write event logs.

Trace Class Read more…

Exceptions in C#

Author - Webner
|
0 Comments
|

An exception is an unexpected or unwanted event that occurs when a program is executed i.e at runtime, that disrupts the normal flow of the program’s instructions. Sometimes while executing the program, a user might face the possibility that the program may crash or show an unexpected event Read more…

EML to MSG Using IndependentSoft C#

Author - Webner
|
0 Comments
|

Convert .eml to .msg files using IndependentSoft C#

EML file extension is created by Microsoft Corporations for Email files. It is also known as RFC 822. In these files, email messages are stored in plain text formats. Microsoft’s Outlook Express uses this file extension to save Mail Read more…

ZipArchive in C#

Author - Webner
|
0 Comments
|

Introduction

ZipArchive is a built-in package in the System.IO.Compression assembly to compress/decompress files in a zip format in C# code. It allows us to work with a collection of compressed files. For this we can do the following things:

Get a single entry of Read more…

Collections in C#

Author - Monika Dhiman
|
0 Comments
|

Collections in C#

Arrays
Arrays are useful for creating and working with a fixed number of strongly typed objects.

Problem with Arrays:
1. Fixed length
2. Insert similar data type elements

Collections
Collections are used to create and Read more…

How to set the values of Metadata (column fields) of Sharepoint Documents

Author - Umang Pasricha
|
1 Comment
|

How to set the values of Metadata(Column fields) of Sharepoint Documents

Here is the code in C# which helps you to change the metadata field values of Sharepoint Files.

//This manager class can be used to obtain a SharePointContext object
OfficeDevPnP.Core.AuthenticationManager authMgr = new Read more…

Fill a PDF form using C# console application

Author - Mahesh Kumar
|
0 Comments
|

Fill a PDF form using C# console application

We will be using the SyncFusion Package to fill out the PDF Form Fields. To add SyncFusion to your project follow these steps :

1. Go to Tool -> NuGet Package Manager -> Manage NuGet Packages For Solution
2. Then search Read more…

Handle data from .msg file parsed by IndependentSoft’s msg.net package

Author - Varun Chopra

Handle data from .msg file parsed by IndependentSoft’s msg.net package

IndepentSoft’s MSG.NET package is used for parsing of outlook .msg files for reading the contents of file and which can be used to display contents on screen or in our custom viewer Read more…

Understanding Nlog .Net Package with Examples

Author - Harleen Kaur
|
1 Comment
|

Record Logs with Nlog .Net Package – Explanation and Examples

Nlog is a free .Net platform based framework designed for generating logs to record the history of events that help to troubleshoot errors and exceptions. Logging is one of the major important area for developers that helps Read more…