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.
C# Compiler Error – CS0708 ‘{0}’: cannot declare instance members i
In this blog post, you’ll learn more about the C# Compiler Error – CS0708 and the related message description C# Compiler Error Code CS0708 C# Compiler Description for the Code :CS0708 ‘{0}’: cannot declare instance members in a static class
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#
C# Compiler Error – CS0711 static classes cannot contain destructor
In this blog post, you’ll learn more about the C# Compiler Error – CS0711 and the related message description C# Compiler Error Code CS0711 C# Compiler Description for the Code :CS0711 Static classes cannot contain destructors
C# Compiler Error – CS8878 a copy constructor ‘{0}’ must be public
In this blog post, you’ll learn more about the C# Compiler Error – CS8878 and the related message description C# Compiler Error Code CS8878 C# Compiler Description for the Code :CS8878 A copy constructor ‘{0}’ must be public or protected because the record is not sealed.
C# Compiler Error – CS0646 cannot specify the defaultmember attribu
In this blog post, you’ll learn more about the C# Compiler Error – CS0646 and the related message description C# Compiler Error Code CS0646 C# Compiler Description for the Code :CS0646 Cannot specify the DefaultMember attribute on a type containing an indexer
C# Compiler Error – CS0836 cannot use anonymous type in a constant
In this blog post, you’ll learn more about the C# Compiler Error – CS0836 and the related message description C# Compiler Error Code CS0836 C# Compiler Description for the Code :CS0836 Cannot use anonymous type in a constant expression
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…
C# Compiler Error – CS1612 cannot modify the return value of ‘{0}’
In this blog post, you’ll learn more about the C# Compiler Error – CS1612 and the related message description C# Compiler Error Code CS1612 C# Compiler Description for the Code :CS1612 Cannot modify the return value of ‘{0}’ because it is not a variable
C# Compiler Error – CS1593 delegate ‘{0}’ does not take {1} argumen
In this blog post, you’ll learn more about the C# Compiler Error – CS1593 and the related message description C# Compiler Error Code CS1593 C# Compiler Description for the Code :CS1593 Delegate ‘{0}’ does not take {1} arguments
C# Compiler Error – CS0528 ‘{0}’ is already listed in interface lis
In this blog post, you’ll learn more about the C# Compiler Error – CS0528 and the related message description C# Compiler Error Code CS0528 C# Compiler Description for the Code :CS0528 ‘{0}’ is already listed in interface list
C# Compiler Error – CS8797 partial method ‘{0}’ must have accessibi
In this blog post, you’ll learn more about the C# Compiler Error – CS8797 and the related message description C# Compiler Error Code CS8797 C# Compiler Description for the Code :CS8797 Partial method ‘{0}’ must have accessibility modifiers because it has ‘out’ parameters.
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”.
C# Compiler Error – CS0745 expected contextual keyword ‘by’
In this blog post, you’ll learn more about the C# Compiler Error – CS0745 and the related message description C# Compiler Error Code CS0745 C# Compiler Description for the Code :CS0745 Expected contextual keyword ‘by’
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.
C# Compiler Warning – CS1700 assembly reference ‘{0}’ is invalid and
In this blog post, you’ll learn more about the C# Compiler Warning – CS1700 and the related message description C# Compiler Warning Code CS1700 C# Compiler Description for the Code :CS1700 Assembly reference ‘{0}’ is invalid and cannot be resolved