Skip to content

Commit 49c5c5b

Browse files
committed
Animation preview For Live View Of Constructor
1 parent 9a00078 commit 49c5c5b

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

content/blog/interview/questionsetsdumps/DoYouKnowThese.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,9 +1598,41 @@ public class Logger
15981598
{
15991599
LogFilePath = "logfile.txt";
16001600
}
1601+
public static void Log(string message)
1602+
{
1603+
Console.WriteLine("Logging message: " + message);
1604+
}
16011605
}
16021606
```
16031607

1608+
### Live Preview of static Constructor
1609+
1610+
![images](./constructorStatic.gif)
1611+
1612+
> Code For Staic Class with Static Constructor
1613+
1614+
```csharp
1615+
public static class Logger
1616+
{
1617+
public static string LogFilePath;
1618+
1619+
// Static constructor
1620+
static Logger()
1621+
{
1622+
LogFilePath = "logfile.txt";
1623+
Console.WriteLine("Logger static constructor");
1624+
}
1625+
public static void Log(string message)
1626+
{
1627+
Console.WriteLine("Logging message: " + message);
1628+
}
1629+
}
1630+
```
1631+
1632+
### Live Preview of static Constructor and static class
1633+
1634+
![images](./staticClass.gif)
1635+
16041636
### Q70. Can we have parameters or access modifiers in static constructor?
16051637

16061638
- **Parameters:** No, static constructors cannot have parameters.
613 KB
Loading
511 KB
Loading

0 commit comments

Comments
 (0)