csharp Tutorials

1. Is it safe to delete bin folder in a razorsharp c# project folder?

By: Niraj : 2023-06-01

Description: In a C# Razor project, the bin folder contains compiled binary files (such as DLLs) generated from the project's source code. These files are necessary for the project to run correctly. Therefore, it is generally not safe to delete the bin folder manually.


2. Display the HTML content in your C# view

By: Niraj : 2023-03-29

Description: To display the HTML content in your success view after parsing, you can use the Html.Raw method in Razor syntax. Html.Raw method is used to render HTML markup to the page without encoding the markup.


3. C Sharp MVC Razor code for a login screen and its controller

By: Niraj : 2023-03-22

Description: Here are the steps to create a login screen in a CSHTML view file and the associated controller code in C#:


4. Using Microsoft Authenticator for 2FA in C Sharp. (C#)

By: Niraj : 2023-03-22

Description: To use Microsoft Authenticator for two-factor authentication in a C# application, you can use the Microsoft Authentication Library (MSAL) to integrate the Authenticator into your application


5. Categories of datatypes in C#

By: Ram Baskar : 2011-02-05

Description: Value types are plain aggregations of data. Instances of value types do not have referential identity nor a referential comparison semantics - equality and inequality comparisons for value types compare the actual data values within the instances, unless the corresponding operators are overloaded. Value types are derived from System.ValueType, always have a default value, and can always be created and copied. Some other limitations on value types are that they cannot derive from each other (but can implement interfaces) and cannot have an explicit default (parameterless) constructor. Examples of value types are some primitive types, such as int (a signed 32-bit integer), float (a 32-bit IEEE floating-point number), char (a 16-bit Unicode code unit), and System.DateTime (identifies a specific point in time with nanosecond precision). Other examples are enum (enumerations) and struct (user defined structures).


6. Hello World sample program in C#

By: Ram Baskar : 2011-02-05

Description: The above line of code tells the compiler to use 'System' as a candidate prefix for types used in the source code. In this case, when the compiler sees use of the 'Console' type later in the source code, it tries to find a type named 'Console', first in the current assembly, followed by all referenced assemblies. In this case the compiler fails to find such a type, since the name of the type is actually 'System.Console'. The compiler then attempts to find a type named 'System.Console' by using the 'System' prefix from the using statement, and this time it succeeds. The using statement allows the programmer to state all candidate prefixes to use during compilation instead of always using full type names.


7. Comments in C#

By: Ram Baskar : 2011-02-05

Description: C# utilizes a double forward slash (//) to indicate the rest of the line is a comment. This is inherited from C++.


8. Preprocessor directives in C#

By: Ram Baskar : 2011-02-05

Description: C# features "preprocessor directives" (though it does not have an actual preprocessor) based on the C preprocessor that allow programmers to define symbols but not macros. Conditionals such as #if, #endif, and #else are also provided. Directives such as #region give hints to editors for code folding.


9. Boxing and unboxing in C#

By: Ram Baskar : 2011-02-05

Description: Boxing is the operation of converting a value of a value type into a value of a corresponding reference type. Boxing in C# is implicit.


10. Major features of C#

By: Ram Baskar : 2011-02-05

Description: By design, C# is the programming language that most directly reflects the underlying Common Language Infrastructure (CLI). Most of its intrinsic types correspond to value-types implemented by the CLI framework. However, the language specification does not state the code generation requirements of the compiler: that is, it does not state that a C# compiler must target a Common Language Runtime, or generate Common Intermediate Language (CIL), or generate any other specific format. Theoretically, a C# compiler could generate machine code like traditional compilers of C++ or Fortran.