Faker
Explore posts from serversCasting and Convert method in C#
Hello guys, sorry to disturb you all; I just have a little question. Consider the following:
My question is, notice that we can cast an int to a double (upcasting) or cast a double to an int (downcasting). But why can't we cast a string representing a number into an it? Why in such cases we should use the Convert.ToInt method?
What is the difference between casting and convert?
61 replies
Properties vs Fields in C#
Hello guys, can someone explain what is the difference between Properties and Fields in C# please. At first I thought that properties and fields were the same thing because they are accessed the same way, like writing
person.name
something like that. But this isn't the case. How do properties work? I noticed they work as method but they don't have any parentheses. They should be named the same way as the fields?
16 replies
LINQ in C#
Hello guys, sorry to disturb you all; I'm currently learning about arrays. I noticed that we can query the array to return a new one using the following syntax:
evenNumbers = numbers.Where(n => n % 2 == 0).ToArray();
I have one question. I understood that the ToArray() method is used to convert the filtering result into an array. But what if we omit it? What would happen? What would evenNumber store? Would we be able to access the filtered values?10 replies
Data types in C#
Hi guys, I'm currently learning C# with microsoft learn. I read elsewhere that C# contains 2 types of data types, primitive and referenced. I have a small background in Java. In java, we use the capitalized the first letter of any referenced data type because they are classes, like String. So, I was wondering if this is different in C#... I noticed that we declare a variable of type string as: string varName where the s is in lowercase.
10 replies
Trying to understand the basics of C# and .NET
Hello guys, sorry to disturb you all; I'm current learning C#l; I just started so I'm trying to understand some basic things first.
From what I have understood, C# is a programming language built on top of the .NET framework. C# is widely used because of its libraries/community support which help in the development of games, web services, desktop app etc... (please correct me if I'm wrong). Now when we run a C# code, our code isn't directly run/translated into machine code.
What happens, is at runtime (when we run the code), our source code is compiled into an intermediate language (in java I know we refer it to as bytecode, here what is its technical name please). This compilation is done by a virtual machine known as the CLR, common language runtime virtual machine. After compilation, this intermediate code is then translated into machine code and executed.
This make C# platform independent meaning we can run it on any OS we want.
Now I have came across 2 things, the Garbage collector and Just-In Time Compilation (JIT). I know that Garbage collector is that "free" memory (RAM) when required. But what about the JIT please; what is its use, why is it useful. I don't have a good understanding of JIT, would really appreciate if someone can explain pls.
56 replies
VB.NET what does it mean? Is it related to .NET ?
Hello guys, sorry tu disturb you all; I was wondering, I read in some places "VB.NET". I know VB (Visual Basics) is a programming language, is VB.NET the same thing as Visual Basics here? Why the .NET extension pls
What is .NET? Just a framework?
21 replies
Resource to learn C#
Hello guys, sorry to disturb you all, I want to learn C# for the basics till advanced level. Can anyone suggest some good resources where I can learn it, practice what I learn and learn by doing please. I need to learn it for uni... I also need to learn ".NET" but don't really know what it is, is it related to C# please
35 replies
KPCKevin Powell - Community
•Created by Faker on 1/1/2025 in #front-end
Meaning of the term "context" in programming
Hello guys, I was reading a few things and I noticed several time the words "depends on the context" is used. What does the term context refers to in programming please
43 replies
KPCKevin Powell - Community
•Created by Faker on 12/11/2024 in #front-end
Axios vs Fetch
Hello guys, sorry to disturb you all; I was just reading a bit about the difference between axios and fetch. From what I have understood, some of the differences is that axios already parse the data in the respond body and so we don't have to manually use something like response.json(). Similarly, when using post requests, axios don't need to include the JSON.stringify() method. By default it already does it. It also has some other benefits like a timeout argument which fetch doesn't have (I think).
My question is, I came across the term "interceptors". I read a bit about it, from what I have understood, it's just something use to modify the request before it is send or modify the response before it is sent back. But I didn't really understand why are interceptors used or why do we need it . Can someone explain please
17 replies
KPCKevin Powell - Community
•Created by Faker on 12/8/2024 in #back-end
Connect.sid in express using express-session
connect.sid in express session refreshes when I reload page, why... the id is same but just when timeout is reached, the connect.sid is destroyed but if I refresh page, it is regenerated, is that normal behaviour ?
3 replies
KPCKevin Powell - Community
•Created by Faker on 12/8/2024 in #back-end
Cookies not stored in postman when we use the front-end
I'm testing user session using postman. When I use postman to log in, a session is created and a cookie is stored. When I try to use the front-end to login, the cookie is created but isn't stored in postman, is this normal ?
15 replies
KPCKevin Powell - Community
•Created by Faker on 12/8/2024 in #back-end
Understanding sessions in express
Hello guys, sorry to disturb you all; I'm currently learning about managing sessions in express and I came across 2 properties:
resave
and saveUninitialized
. I didn't understand these 2 properties; where and why do we use them? What does they do? From what I have understand, resave
prevents the session from storing data for each request in our store (but what if we don't use a store? Like in my case; when is a store needed?) while saveUninitialized
just makes sure that we create a cookie if we modify the request session1 replies
KPCKevin Powell - Community
•Created by Faker on 12/8/2024 in #front-end
Why image appears "pixelated" despite object-fit cover used
16 replies