C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
iOS
Java
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
13
Reply
What is static class?
Jeetendra Gund
11y
2.8k
2
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
A static class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated. You access the members of a static class by using the class name itself. For example, if you have a static class that is named UtilityClass that has a public method named MethodA,: UtilityClass.MethodA();Use of static class: A static class can be used as a convenient container for sets of methods that just operate on input parameters and do not have to get or set any internal instance fields. For example, the static System.Math class contains methods that perform mathematical operations, without any requirement to store or retrieve data that is unique to a particular instance of the Math class. double dub = -3.14; Console.WriteLine(Math.Abs(dub)); Console.WriteLine(Math.Floor(dub)); Console.WriteLine(Math.Round(Math.Abs(dub)));// Output: // 3.14 // -4 // 3 A static constructor is only called one time, and a static class remains in memory for the lifetime of the application domain in which your program resides. Main features of a static class: • Contains only static members. • Cannot be instantiated. • Is sealed. • Cannot contain Instance Constructors.
Manju lata Yadav
11y
1
Static can execute without main
Mukesh Kumar
8y
0
1. A static class is a class which cannot be instantiated. 2. A static class can have only static members. 3. Static members of a class can by accessed by dot(.) operator. for example Employee.GetEmployee() 4. Static class is implicitly sealed. Therefore a class cannot inherit a static class.
Anil Jha
9y
0
Static class is a class which cannot be instantiated.The common properties can be declared in Static class.Ex : In a school, 10 students have the same common features.So we can keep the common properties in the Static class.
satish kumar
10y
0
A static class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated. In other words, you cannot use the new keyword to create a variable of the class type
Kml Surani
10y
0
Static class it a type of class whose instance can not be created. we can declare static member function , field in static class we can not create non static member function and field in a static class
Pankaj Kumar Choudhary
10y
0
1.all the members of the class are static. 2.not possible to crate the object of the static class. 3.methods r call by name of class.method name. 4.this is a sealed one
Sunil Gaded
11y
0
the class which doesn't need any instantiation to access its data members and methods. They can called directly by the class name.
Ashish
11y
0
http://www.dotnetperls.com/static-class
Munesh Sharma
11y
0
Static class is a class which is call without any instance of objects.
Dileep Kumar Patel
11y
0
Static class is a class which is faster than instance class . Since Static class doesn't require object creation hence it is faster compared to instance class . Inheritance is not allowed on the static classes hence a static class can't act as a base class as well as derived class . regards Lok http://skillgun.com/csharp/interview-questions-and-answers
Palle Technologies
11y
0
Features of Static class 1. Inheritance not allow. 2. Creating instance not allow. 3. Must contain only static properties , fields , constructor and methods.
shimab alam
11y
0
A static class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated. In other words, you cannot use the new keyword to create a variable of the class type. Because there is no instance variable, you access the members of a static class by using the class name itself.. for example visit this link.. http://www.c-sharpcorner.com/uploadfile/hirendra_singh/static-classes-in-C-Sharp/
Mukesh Kumar Tiwari
11y
0
What is Serialization and Deserialization?
What is Business Logic?
Message