Skip to main content

How can we identify partial classes in C#?

The class declaration with the keyword partial is denoting that the class is a partial class. Physically the partial classes can be available in different files/locations. The C# compiler treat them as a single class at the time of compilation.


        public partial class PartialClassExample
        {
            public void MethodOne(int input)
            {
                ///Do something.
            }
        }

        public partial class PartialClassExample
        {
            public string MethodTwo(string input)
            {
                return string.Format("Hello, {0}", input);
            }
        }


The PartialClassExample can be sit in different files but at the time of compilation they will be merged together.

Hope this helps!

Comments

Popular posts from this blog

Multiplication Table in SQL Server

Multiplication Table in SQL Server This query gives the multiplication table from 1 to 10. DECLARE @A INT,                   @B INT,                   @C INT,                   @D VARCHAR (100)                   SELECT @A=1                  PRINT ' MULTIPLICATION TABLE 1-10' /****************************************/ /* Created By : Loganathan V */ /* Created On: 20-Sep-2010, Monday */ /* Purpose : Multiplication Table */ /* How to : RUN THE QUERY */ /****************************************/ WHILE (@A<=10) BEGIN         ...

The React Cookbook Advanced Recipes to Level Up Your Next React App

Virtual machines vs. Containers

One of the questions that often comes up to anybody who's in the cloud space is, what are the differences between virtual machines and container? When should use one versus the other? Unfortunately the answer is not so simple clear-cut. We can't say you should always use containers or always use virtual machines. But, there are some things to keep in mind. There are certain kinds of applications which benefit from running in containers or using micro services in general. Microservices means taking an application and decomposing it into smaller parts. This is really good if you need to build a web scale application and you need to have the ability to turn up different dials of performance somewhat independent of each other. For example, take the middleware piece or the front end or the database piece and you need to scale them individually. The other benefit of containers is a consistency between the development environment and the production environment where you can take thing...