❔ I cant find the mistake
dotnet
YouTube
Object Oriented Programming: Methods and Members | C# 101 [17 of 19]
Learn more ➡️ https://learn.microsoft.com/users/dotnet/collections/yz26f8y64n7k07
Now our objects need data and behaviors. What can our objects DO and what do they HAVE? Let’s learn how to make members and methods with C# and .NET.
👩💻 Get the .NET Interactive Notebooks and follow along at home: https://aka.ms/csharp101notebooks
🏫 Free self-...
17 Replies
$details
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Specifically, please show what errors you are getting
Something being underlined* isn't sufficient information.
Schweregrad Code Beschreibung Projekt Datei Zeile Spalte Unterdrückungszustand
Fehler CS1061 "Transaction" enthält keine Definition für "Amount", und es konnte keine zugängliche Amount-Erweiterungsmethode gefunden werden, die ein erstes Argument vom Typ "Transaction" akzeptiert (möglicherweise fehlt eine using-Direktive oder ein Assemblyverweis). ConsoleApp2 C:\Users\julia\OneDrive\Desktop\C# Projects.Net Curse OOP\ConsoleApp2\BankAccount.cs 55 46 Aktiv
oh its german srry
MODiX#0152
Severity Code Description Project File Row Column Suppression State
Error CS1061 "Transaction" does not contain a definition for "Amount", and no accessible Amount extension method could be found that accepts an initial argument of type "Transaction" (a using directive or assembly reference may be missing). ConsoleApp2 C:\Users\julia\OneDrive\Desktop\C# Projects.Net Curse OOP\ConsoleApp2\BankAccount.cs 55 46 Active
Quoted by
<@203166497198047232> from #bot-spam (click here)
React with ❌ to remove this embed.
i just copied the tutorial but it doesn't work
Does the tutorial have the
using System.Transactions;
line at the top of the file?dont think so but i i don use it the error Type or namespace name wasn't found
Correct, beacuse that line was letting you refer to a Class within the System.Transactions namespace that you weren't intending to use
This line here:
private List<Transaction> allTransactions = new List<Transaction>();
is in your BankAccount
class, which is in your MyBank
namespace, which means it doesn't know about your Transaction
class, because that's in your Classes
namespacei thought if i use public class it can communicate
so can it only know about if it is in the same namespace
They can, but it still can't "see" it (by default) so to speak because it's in a different namespace
Correct, you need to tell that class/file to "use" a different namespace
how?
do i have to write over it using "this class"
yeah, in the same way that you have:
using System.Collections.Generic;
using System;
you could also add:
using Classes
private List<Classes.Transaction> allTransactions = new List<Classes.Transaction>();
thanks
or that yes 🙂
If you really want to make your life more miserable, sure, using fully-qualified names works
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.