Category: C#

How to perform Shallow Copy in C# ?

To perform Shallow copy in C# , you can use the this.MemberwiseClone() method. How to perform Shallow Copy in C# ? Below is a sample code snippet that contains a method ShallowCopy to make a copy of the object.

DateTime and Null value in C#

Assume that you want a variable of type DateTime and you would like to have the uninitialized value or null value , you can use the nullable DateTime type. DateTime and Null value in C# When you define a DateTime variable and dont initialize it , the default value is the DateTime.MinValue. You can simply define the type as Nullable DateTime as shown in the…

C# Compiler Error – CS8152 ‘{0}’ does not implement interface membe

In this blog post, you’ll learn more about the C# Compiler Error – CS8152 and the related message description C# Compiler Error Code CS8152 C# Compiler Description for the Code :CS8152 ‘{0}’ does not implement interface member ‘{1}’. ‘{2}’ cannot implement ‘{1}’ because it does not have matching return by reference.

C# Compiler Error – CS1954 the best overloaded method match ‘{0}’ f

In this blog post, you’ll learn more about the C# Compiler Error – CS1954 and the related message description C# Compiler Error Code CS1954 C# Compiler Description for the Code :CS1954 The best overloaded method match ‘{0}’ for the collection initializer element cannot be used. Collection initializer ‘Add’ methods cannot have ref or out parameters.

How to Get the File Version of the Assembly in .NET (C#)?

The developers can use the methods and properties available in the FileVersionInfo class to retrieve the File Version of the Assembly in .NET (C#). How to Get the File Version of the Assembly in .NET (C#)? Below is a sample code snippet demonstrating how to retrieve it.

SelectMany Example in LINQ and C#

Below is a sample source code demonstrating the usage of the SelectMany method in LINQ and C#. One of the usage of the SelectMany is to return the flat list an avoid returning the lists of lists. SelectMany Example in LINQ and C#

How to Validate a Social Security Number using Regex in C# ?

If you need to validate a social security number in C# , the regular expressions is one of the easy wat to do it . Below is a sample code snippet demonstrating how to validate a social security number using regular expression . The pattern for matching it is that SSN number contains nine digits grouped with hypen as option. How to Validate a Social…

Fixed-Point Numeric Formatting in C#

The Fixed-Point Numeric Formatting string returns the integer and the decimal digits with the negative symbol (if provided). The Fixed-Point Numeric formatting staring also accepts the precision specifier which indicates the number of decimal digits . Fixed-Point Numeric Formatting in C# Below is a sample sourecode demonstrating the Fixed-Point Numeric formatting using the Numeric Format String “F” and “F4”.

Can the PDF file be saved in the Media Library of Windows Phone?

This is one of the common question asked by few developers or Windows phone users. Can the PDF file be saved in the Media Library of Windows Phone? The Media Library of Windows Phone allows the users to save only the Images and hence there is no possibility to save PDF or files of any file format in it.