Posts

A simple question of C#

 Hello o/ I will write a C# program and you have to predict the output of the program. namespace Test { class A { public A() { Console.WriteLine("A is called"); } } class B : A { public B() { Console.WriteLine("B is called"); } } public class Program { public static void Main(string[] args) { B obj = new B(); } } } so, what do you think it will output? the answer isn't that obvious. let me first show you the answer: A is called B is called you might be wondering why it's also printing the constructor of A? we didn't call constructor of A using base() method but still it still got called. the answer is simple, compiler adds base() call in the child.  but why??? so basically to create an instance of any class we have to have some methods defined inside System.Object which we get while creating an object. in sim...

Collections in c#

 Hello, in this blog I will talk about collections in c#. all the things written will be in my language and not in technical jargon. There are two types (There are other types of primitive arrays too which I will not cover in this blog) of collections in c#: non-generic collection: ArrayList, Stack, Queue etc... generic collection: List<T>, Stack<T>, Queue<T> etc.. Non-Generic collection: It can contain data of any type. you don't have to specify a type while creating an instance of it. It's size is dynamic means that it can grow or shrink at runtime add, remove from the middle of a collection ( which we can't do in traditional c like array ) It's not type safe since it can contain different types of objects. Generic collections: It can only contain datatype given by the developer which creating an instance of it. It's also dynamic. you can add, remove etc in the collections. It's only contains objects with specified type, so it's type safe...

ownership and file permission are different thing in linux

 Difference between ownership and file permission Ownership: It's related to who own a specific file, for example if your username is "name" then you will find that most files in your home directory will be owned by "name" user which is you. File Permission: It's basically what the owner or other user can do with the file, like if they can read, write or execute a specific file.

Figuring out how to use Blogger :)

 Hello, I am new to all the blogging scene so currently figuring out how to use it. It seems pretty simple though. don't know if anyone would even read it but still writing it lol. anyways just wanted to write something. see ya!