C
C#2mo ago
Jayde

Im coding my 3D engine called STRATIS and there are two errors.

Im coding my 3D engine called STRATIS and there are two errors. foreach (var tri in meshCube.tris) The "tri" in the code is showing an error for "A local or parameter named "tri" cannot be declared in this scope because that name is used in an enclosing local scope to define a local or paremeter. and the second error is : Triangle triProjected = new Triangle(); // Initialize triTranslated the triProjected cannot be declared for the same reason.
3 Replies
SpReeD
SpReeD2mo ago
So you have to change the name of the variable ¯\_(ツ)_/¯
Jayde
Jayde2mo ago
ive tried it just makes the entire thing bug
SpReeD
SpReeD2mo ago
The error is pretty straight-forward, in your scope, which means class in this context, there's already a field or property with that name, so you have the same variable scoped inside a method and the method containing object. The only solution is to rename one of the variables, usually you rename the one with the least scope, hence the one inside the method. Also method scoped variablenames doesn't need to be self-explanatory, so a single char variablename is fine, like in a foreach block.
Want results from more Discord servers?
Add your server
More Posts
What's the difference between webhook and sending an HTTP request to an endpoint exposed by clientHi I'm learning about building web api at the moment. Came across this concept called webhook and isIdentifying the Framework in a .csproj fileWhen you are trying to identify the framework from a csproj file, sometimes there are multiple versiMSBuild For c# project with c++ dllsSo i have a c# project and a c++ cmake project , the c# project is referenced by the actual program ✅ Typically how is an image stored?Im trying to set up an ASP.NET Project where i have a profile section. Users can then choose to uplMarshalDirectiveException: Cannot marshal 'return value': Invalid managed/unmanaged type combinationBasically trying to wrap a dll (wiiuse library) into my godot game with c# and whenever i call my wrNeed help to get data from MongoDBi have my mongodb data that like this ``` bson [ { "_id": {"$oid": "665b193178262482ba1f5bcaTrying to create objects using a loop, but don't know what i'm doing wrong?so i'm trying to update my turtle race simulator using tasks, one of the changes is to be able to chCan't get Data in Controller by Ajax from View in dotnet MVC CoreI am trying to pass data from a view to my controller. I am getting the values in Ajax correctly, buQuestion about AvaloniaSo im a beginner in Avalonia and im watching a youtube tutorial series (more specifically [this tutoList<> modificationI want ot modify all elements in a List<>, but im having trouble. This is my code. Which gives an er