The king of kings
The king of kings
Explore posts from servers
CC#
Created by The king of kings on 10/31/2023 in #help
I wonder if I should be using the IEquatable interface instead of IComparable to compare on objects
I wanna ask you for your opinion to use the IEquatable interface instead of IComparable? I mean obviously I dpn't need to sort my list of ogjects or perform any sorting, therefore I might need to use IEquatable since it only checks if an object is equal to another object, what do you think?https://paste.mod.gg/fsksuwwdtlvl/3
121 replies
CC#
Created by The king of kings on 7/27/2023 in #help
❔ Need help with user account
I'm creating user account using methods, but it seems a bit unclear to me how to invoke and use these methods!
128 replies
CC#
Created by The king of kings on 7/11/2023 in #help
❔ TCP networking
I have a project consisted of two programs and I need to update both of them to enable the user to write text in the client program and send it to the server
25 replies
CC#
Created by The king of kings on 6/28/2023 in #help
❔ Asynchronous TCP-programming
Hey guys, I have a project where I need to implement client in order to send data to a program called Centralcomputer.
196 replies
CC#
Created by The king of kings on 6/26/2023 in #help
❔ Validating user input
I have created a project and I need to learn how to validate user inputs
533 replies
CC#
Created by The king of kings on 6/25/2023 in #help
❔ I'm trying to implement this networking project, but not sure how to do it?
26 replies
CC#
Created by The king of kings on 6/20/2023 in #help
❔ I have a project and I need to implement a functionality to create a membership for users
I need help with using exporting & importing data in a text file in a my console application project
104 replies
CC#
Created by The king of kings on 6/8/2023 in #help
❔ Can someone explain to me what serialization and deserialization means?
Hello guys, I watched some tutorials on this concept, but they're using JSON data and didn't quite understand it.
68 replies
CC#
Created by The king of kings on 6/1/2023 in #help
❔ Using text file to add data into a list
Hello, I would like to use text file to add data from a text file that are saved in a text document.
403 replies
CC#
Created by The king of kings on 5/29/2023 in #help
❔ The easiest way to use a uncompleted project files in a new Windows Forms app
20 replies
CC#
Created by The king of kings on 5/27/2023 in #help
❔ Creating a new project in Windows forms app and adding controls
128 replies
CC#
Created by The king of kings on 5/19/2023 in #help
❔ I'm trying to implement a search function using LINQ
https://paste.mod.gg/gctsykkoclwi/3
public void SearchBook() // Defining a method and use it to access the property list and search for books
{
Console.WriteLine("Choose from meny: "); // Dispaly a meny for a book type
Console.WriteLine("\n\n\t [1] Search title"
+ "\n\t [2] Search author");
if (int.TryParse(Console.ReadLine(), out int meny))
switch (meny)
{
case 1:
Console.WriteLine("Search by title: ");
var bookTitle = Console.ReadLine();
var searchTitle = bookShelf.Where(x => x.Title.Contains(bookTitle));

if (bookTitle != null)
{
foreach (var book in searchTitle)
{
Console.WriteLine(book);
}
}
break;
case 2:
Console.WriteLine("Search by author: ");
var bookAuthor = Console.ReadLine();
var searchAuthor = bookShelf.Where(x => x.Author.Contains(bookAuthor));

if (bookAuthor != null)
{
foreach (var book in searchAuthor)
{
Console.WriteLine(book);
}
}
break;
}
}
public void SearchBook() // Defining a method and use it to access the property list and search for books
{
Console.WriteLine("Choose from meny: "); // Dispaly a meny for a book type
Console.WriteLine("\n\n\t [1] Search title"
+ "\n\t [2] Search author");
if (int.TryParse(Console.ReadLine(), out int meny))
switch (meny)
{
case 1:
Console.WriteLine("Search by title: ");
var bookTitle = Console.ReadLine();
var searchTitle = bookShelf.Where(x => x.Title.Contains(bookTitle));

if (bookTitle != null)
{
foreach (var book in searchTitle)
{
Console.WriteLine(book);
}
}
break;
case 2:
Console.WriteLine("Search by author: ");
var bookAuthor = Console.ReadLine();
var searchAuthor = bookShelf.Where(x => x.Author.Contains(bookAuthor));

if (bookAuthor != null)
{
foreach (var book in searchAuthor)
{
Console.WriteLine(book);
}
}
break;
}
}
59 replies
CC#
Created by The king of kings on 5/18/2023 in #help
❔ Are these concepts encapsulation & polymorphism correctly implemented?
31 replies
CC#
Created by The king of kings on 5/8/2023 in #help
❔ Using inheritance in my project
I'm building a book shelf project and I need help with modifying my ctor so I could assign each input for one of the subclasses or the books https://gist.github.com/Programmer-Faraj/9a2f90285e21996c4cf7577505ce6853
184 replies
CC#
Created by The king of kings on 4/29/2023 in #help
❔ I have a problem in my code and can't find it
136 replies
CC#
Created by The king of kings on 4/27/2023 in #help
❔ I have implemented a project and need to solve these errors
{
int antalOrd, summa;
List<string> ordLista = new List<string>();
Console.WriteLine("Välkommen till Räknaren!");
Console.Write("Hur många ord vill su skriva in? Antal: ");
Int32.TryParse(Console.ReadLine(), out antalOrd);
for (int i = 0; i < antalOrd; i++)
{
Console.WriteLine("Skriv in ord nr." + (i + 1) + ": ");
ordLista.Add(Console.ReadLine());
}
if (ordLista.Count > 0)
int summa = RäknaBokstäver(ordLista);
Console.WriteLine("Alla ord du har skrivit har totalt " + summa + " symboler.");
else
Console.WriteLine("Du har valt att inte skriva några ord.");
Console.ReadLine();
}
static void RäknaBokstäver(List<string> mottagenLista)
{
summa = 0;
for (int i = 0; i < mottagenLista.Count; i++)
{
summa += mottagenLista[i].Length;
return summa;
}
}
{
int antalOrd, summa;
List<string> ordLista = new List<string>();
Console.WriteLine("Välkommen till Räknaren!");
Console.Write("Hur många ord vill su skriva in? Antal: ");
Int32.TryParse(Console.ReadLine(), out antalOrd);
for (int i = 0; i < antalOrd; i++)
{
Console.WriteLine("Skriv in ord nr." + (i + 1) + ": ");
ordLista.Add(Console.ReadLine());
}
if (ordLista.Count > 0)
int summa = RäknaBokstäver(ordLista);
Console.WriteLine("Alla ord du har skrivit har totalt " + summa + " symboler.");
else
Console.WriteLine("Du har valt att inte skriva några ord.");
Console.ReadLine();
}
static void RäknaBokstäver(List<string> mottagenLista)
{
summa = 0;
for (int i = 0; i < mottagenLista.Count; i++)
{
summa += mottagenLista[i].Length;
return summa;
}
}
28 replies
CC#
Created by The king of kings on 4/27/2023 in #help
❔ I need help with Binary search alphabetically
Guys, I have this assignment where they want me to implement this Binary search algo
Console.WriteLine("\n\tWhich letter should the search start with?");
string key = Console.ReadLine(); ; // Receives the user's search
if (key.Length <= 0) key = "a"; // Makes sure the search is always something, in this case "a"
/*
* BINARY SEARCH using letters
*
* Based on the new tools we've gone through before (CompareTo and extracting single chars from strings for comparisons) so
* here we should write a binary search to look for letters.
*
*/
LetterPrint(wordList); // Print the entire list using our method.
Console.WriteLine("\n\tWhich letter should the search start with?");
string key = Console.ReadLine(); ; // Receives the user's search
if (key.Length <= 0) key = "a"; // Makes sure the search is always something, in this case "a"
/*
* BINARY SEARCH using letters
*
* Based on the new tools we've gone through before (CompareTo and extracting single chars from strings for comparisons) so
* here we should write a binary search to look for letters.
*
*/
LetterPrint(wordList); // Print the entire list using our method.
226 replies
CC#
Created by The king of kings on 4/25/2023 in #help
❔ Breaking an infinite while loop
I need help with stoping an infinite loop when the search word is found
60 replies
CC#
Created by The king of kings on 4/24/2023 in #help
❔ Applying binary search into my project
I need help with implementing binary search in this project https://gist.github.com/Programmer-Faraj/fdc814033943b69af8bdf19a00b83b14
572 replies
CC#
Created by The king of kings on 4/23/2023 in #help
❔ Using the DateTime.Now
How do I apply a date for each blog that should have a publication date? https://gist.github.com/Programmer-Faraj/fdc814033943b69af8bdf19a00b83b14
82 replies