Juliandyce
Juliandyce
CC#
Created by Juliandyce on 1/28/2024 in #help
✅ How to automate update-database
I am bilding a Web server but i have to typ in update-database how can i automate this in Blazor in the Program.cs file. Im srry i cant be more specific because im new in this kind of stuff. The tutorial i watch is just outdated the code changed a bit. Tanks for your time and helping. In the tutorial https://www.youtube.com/watch?v=JeLnR_ObHd8&t=4624s on 1:16:57 - 1:17:17 and i have the most recent Version of Microsoft Visual Studio if u also have it and it looks like that: var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseMigrationsEndPoint(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); }
28 replies
CC#
Created by Juliandyce on 10/1/2023 in #help
❔ Webapp
If I want to create my own web app with C# and also want to get something out of the process, what should I use? Asp.net core, Blazor, ...
5 replies
CC#
Created by Juliandyce on 7/14/2023 in #help
❔ I cant find the mistake
.Amount gets unterlined
using System.Transactions;
using System.Collections.Generic;
using System;


namespace MyBank
{
class Bank
{
static void Main(string[] args)
{
var account = new BankAccount("Julian", 10000);
Console.WriteLine("Account {0} was createt for {1} with {2}.", account.Number, account.Owner, account.Balance);

}
}
}
namespace Classes
{
public class Transaction
{
public decimal Amount { get; }
public DateTime Date { get; }
public string Notes { get; }

public Transaction(decimal amount, DateTime date, string note)
{
Amount = amount;
Date = date;
Notes = note;
}
}
}
namespace MyBank
{
public class BankAccount
{

public string Number
{
get;
}
public string Owner
{
get;
set;
}
public decimal Balance
{
get
{
decimal balance = 0;
foreach (var item in allTransactions)
{
balance = balance + item.Amount;
}
return balance;
}
}

private static int accountNumberSeed = 0000000001;

private List<Transaction> allTransactions = new List<Transaction>();

public BankAccount(string name, decimal initialBalance)
{
this.Owner = name;
this.Number = accountNumberSeed.ToString();
accountNumberSeed++;
}

public void MakeDeposit(decimal amount, DateTime date, string note)
{
}

public void MakeWithdrawal(decimal amount, DateTime date, string note)
{
}

}
}
using System.Transactions;
using System.Collections.Generic;
using System;


namespace MyBank
{
class Bank
{
static void Main(string[] args)
{
var account = new BankAccount("Julian", 10000);
Console.WriteLine("Account {0} was createt for {1} with {2}.", account.Number, account.Owner, account.Balance);

}
}
}
namespace Classes
{
public class Transaction
{
public decimal Amount { get; }
public DateTime Date { get; }
public string Notes { get; }

public Transaction(decimal amount, DateTime date, string note)
{
Amount = amount;
Date = date;
Notes = note;
}
}
}
namespace MyBank
{
public class BankAccount
{

public string Number
{
get;
}
public string Owner
{
get;
set;
}
public decimal Balance
{
get
{
decimal balance = 0;
foreach (var item in allTransactions)
{
balance = balance + item.Amount;
}
return balance;
}
}

private static int accountNumberSeed = 0000000001;

private List<Transaction> allTransactions = new List<Transaction>();

public BankAccount(string name, decimal initialBalance)
{
this.Owner = name;
this.Number = accountNumberSeed.ToString();
accountNumberSeed++;
}

public void MakeDeposit(decimal amount, DateTime date, string note)
{
}

public void MakeWithdrawal(decimal amount, DateTime date, string note)
{
}

}
}
https://www.youtube.com/watch?v=xLhm3bEG__c&t=222s c# tutorial of .Net
25 replies
CC#
Created by Juliandyce on 7/14/2023 in #help
❔ How can i copy code in this black window on discord?
.
6 replies
CC#
Created by Juliandyce on 7/12/2023 in #help
❔ searching mistake
namespace App2 { public class Program14 { private static void SayHello() {
Console.Write("What is ur name?"); string name = Console.ReadLine(); Console.WriteLine("Hello {0}", name); } static void Main(string[] args) { SayHello(); } } } CS1022 Type or namespace definition or end of file expected.
3 replies
CC#
Created by Juliandyce on 7/12/2023 in #help
❔ Stringbuilder remove
i have problem with remove in the following program: public class Program11 {
static void Main(string[] args) { StringBuilder sb = new StringBuilder("Hello World!", 50); //"Hallo Welt! start String //50 maximale Länge des Strings sb.Append(" How are u?"); // string hinten anfügen sb.AppendLine(); sb.AppendLine("I am fine!"); //string hinten anfügen zeilenumbruch sb.Insert(0, ":) ");

Console.WriteLine(sb.ToString()); sb.Remove(9, 14); Console.WriteLine(sb.ToString()); } }
} I wanna remove World witch should go from 9-14: output before remove; 🙂 Hello World! How are u? I am fine! output after remove: 🙂 Hello u? I am fine!
16 replies
CC#
Created by Juliandyce on 7/10/2023 in #help
❔ can someone explain the me the new operator
Especially the syntax behind this example: Random rnd = new Random(); Can u compare the random before the = with int, string and the random after then says that a random number should be generated and new simply says that it should be regenerated every time the program is executed?
48 replies
CC#
Created by Juliandyce on 7/8/2023 in #help
❔ Erklärung
First of all: I am new to programming. i want to only write nummers in a array that are greater then 10 which condition do i have to put into this programm: (at the ..........) int[] numArray = { 1, 11, 22 }; Console.WriteLine("> 10 : {0}", Array.Find(numArray, .........));
7 replies
CC#
Created by Juliandyce on 7/8/2023 in #help
❔ Erklärung an Beispiel
First of all: I am new to programming. I would like to get an explanation of the "Copy" command to the following example (as simple as possible): int[] randNums = { 1, 4, 9, 2 }; Array.Sort(randNums); Array.Reverse(randNums); int[] srcArray = { 1, 2, 3 }; int[] destArray = new int[2]; int startInd = 0; int length = 2; Array.Copy(srcArray, startInd, destArray, 0, length); PrintArray(destArray, "Copy"); And then of "Array.CreateInstance " too: Array anotherArray = Array.CreateInstance(typeof(int),length); ty
12 replies