In C# terms, “static” means “relating to the type itself, rather than an instance of the type”. You access a static member using the type name instead of a reference or a value, e.g. Guid. NewGuid(). In addition to methods and variables, you can also declare a class to be static (since C# 2.0).
Every Question..What does it mean? Why is this? How it works?
Microsoft .Net (pronounced dot (.) net) may be a package element that runs on the Windows software package.
.Net provides tools and libraries that change developers to form Windows package a lot of quicker and easier.
Microsoft describes it as:".Net is that the Microsoft internet Service strategy to attach data, people,
system and devices through software".I'm Choulla Naresh..!
Monday, August 24, 2020
Can we declare constructor as private?
Yes, we can declare a constructor as private.
If we declare a constructor as private we are not able to create an object of a class. We can use this private constructor in the Singleton Design Pattern.
Can abstract class have constructor?
Yes, Abstract Classes can have constructors!
An abstract class can have a constructor though it cannot be instantiated. But the constructor defined in an abstract class can be used for the instantiation of a concrete class of this abstract class.
Can you have a static method in a non static class?
You can define one or more static methods in a non-static class. Static methods can be called without creating an object. You cannot call static methods using an object of the non-static class.
Friday, August 21, 2020
What are the differences between REST and SOAP?
- SOAP stands for Simple Object Access Protocol whereas REST stands for Representational State Transfer.
- The SOAP is an XML based protocol whereas REST is not a protocol but it is an architectural pattern i.e. resource-based architecture.
- SOAP has specifications for both stateless and state-full implementation whereas REST is completely stateless.
- SOAP enforces message format as XML whereas REST does not enforce message format as XML or JSON.
- The SOAP message consists of an envelope which includes SOAP headers and body to store the actual information we want to send whereas REST uses the HTTP build-in headers (with a variety of media-types) to store the information and uses the HTTP GET, POST, PUT and DELETE methods to perform CRUD operations.
- SOAP uses interfaces and named operations to expose the service whereas to expose resources (service) REST uses URI and methods like (GET, PUT, POST, DELETE).
- SOAP Performance is slow as compared to REST.
.net core and .net framework difference
Developers use the. NET framework to create Windows desktop applications and server-based applications. This includes ASP.NET web applications. NET Core is used to create server applications that run on Windows, Linux, and Mac.
SingleorDefault vs Firstordefault example
Single
It returns a single specific element from a collection of elements if the element match found. An exception is thrown, if none or more than one match found for that element in the collection.
SingleOrDefault
It returns a single specific element from a collection of elements if the element match found. An exception is thrown if more than one match found for that element in the collection. The default value is returned, if no match is found for that element in the collection.
First
It returns the first specific element from a collection of elements if one or more than one match found for that element. An exception is thrown, if no match is found for that element in the collection.
FirstOrDefault
It returns the first specific element from a collection of elements if one or more than one match found for that element. The default value is returned, if no match is found for that element in the collection.
Tuesday, August 18, 2020
When to use Interface?
If your child classes should implement a certain group of methods/functionalities but each of the child classes is free to provide its own implementation then use interfaces.
Sunday, August 16, 2020
When to use Abstract Classes in C#?
When we have a requirement where our base class should provide the default implementation of certain methods whereas other methods should be open to being overridden by child classes use abstract classes.
Friday, August 14, 2020
How can you detect the client's browser name?
You can use the navigator. appName and navigator. userAgent properties.