Joschi
Joschi
CC#
Created by Bananas on 11/24/2024 in #help
Manage small university project
No! You won't be able to distinguish between it giving good advice and it hallucinating.
23 replies
CC#
Created by Bananas on 11/24/2024 in #help
Manage small university project
Don't worry about something like that as a beginner. Just try to write down what you want your app to do and get started. Don't worry about the "correct" way of doing it, just try to get something working.
23 replies
CC#
Created by HtmlCompiler on 11/23/2024 in #help
✅ doubts about migrations
Yeah right thinking about it, they have to be or EFCore could not migrate the DB at runtime.
10 replies
CC#
Created by HtmlCompiler on 11/23/2024 in #help
✅ doubts about migrations
Are the designer and migration files even icluded in the compilation?
10 replies
CC#
Created by HtmlCompiler on 11/23/2024 in #help
✅ doubts about migrations
What problem would you solve by moving them into another problem or squashing them?
10 replies
CC#
Created by steven preadly on 11/22/2024 in #help
do defined route added to the the routes table when the app.Run() executed or before?
Thats not the actual Pipeline. Thats just the registering of the pipeline. The pipeline runs, when a http request comes in. And the program only runs after app.Run is called.
5 replies
CC#
Created by steven preadly on 11/22/2024 in #help
do defined route added to the the routes table when the app.Run() executed or before?
Do you mean stepping through in the Program.cs?
5 replies
CC#
Created by on 11/21/2024 in #help
When should one use a custom delegate instead of Func/Action/Predicate?
Multicast delegates is how events are implement in C# as far as I know. Delegates are not that often used, but they are valuable if you go deeper into the functional style of C#. https://www.youtube.com/watch?v=2TXvwUgaMHs&t=1s
122 replies
CC#
Created by Headless on 11/22/2024 in #help
Manipulating Strings
The idea would be, that you have a full script, 300+ pages long. Now you want to convert all the camera directions and positions into the case you prefer. It's way faster writing code for you to do that. What you got there is just the bases for doing it.
13 replies
CC#
Created by Headless on 11/22/2024 in #help
Manipulating Strings
Strings in C# are immutable. Meaning you cannot change the actual string itself, just creating new ones. So what you want to do is extract the parts you want to change, change them and then rebuild the full string. You are more or less doing it, but I guess your input should be the original unmodified string. Without any ToUpper mixed in there like you did. There are ways of doing this more efficient, but you should not worry about that right now.
13 replies
CC#
Created by Headless on 11/22/2024 in #help
Manipulating Strings
The code on the right is your code correct?
13 replies
CC#
Created by Headless on 11/22/2024 in #help
Manipulating Strings
Ok what exactly is your goal here? Can you post the exact final output you expect?
13 replies
CC#
Created by Headless on 11/22/2024 in #help
Manipulating Strings
What exactly is your problem here? Why cant you just call ToUpper on that string?
13 replies
CC#
Created by on 11/21/2024 in #help
Null check
There is one small reason for is over == and that is, that == could technically be overwritten. While is cannot.
12 replies
CC#
Created by Ahata on 11/18/2024 in #help
Inheritance
Ok found the problem and it has nothing to do with inheritance.
c#
private Texture2D ltexture;

public Texture2D texture
{
get{ return ltexture;}
set{ ltexture = texture;}
}

public Entity(Texture2D texture, Vector2 position)
{
this.position = position;
this.texture = texture;
}
c#
private Texture2D ltexture;

public Texture2D texture
{
get{ return ltexture;}
set{ ltexture = texture;}
}

public Entity(Texture2D texture, Vector2 position)
{
this.position = position;
this.texture = texture;
}
Your constructor sets the value of the texture property, but your setter sets its value to itself. The setter has to set the value of the backing field (ltexture) to value.
c#
private Texture2D ltexture;

public Texture2D texture
{
get{ return ltexture;}
set{ ltexture = value;}
}

public Entity(Texture2D texture, Vector2 position)
{
this.position = position;
this.texture = texture;
}
c#
private Texture2D ltexture;

public Texture2D texture
{
get{ return ltexture;}
set{ ltexture = value;}
}

public Entity(Texture2D texture, Vector2 position)
{
this.position = position;
this.texture = texture;
}
While we are at it. You should adhere to the C# format standards. Properties start with uppercase letters and fields start lowercase and often even with a underscore. And if you don't have a special reason for creating a backing field yourself you should use auto properties.
c#
class Entity
{
// Auto Property
public Vector2 Position {get; set;}

// Backing Field
private Texture2D _texture;

// Property with Backing Field
public Texture2D Texture
{
get{ return _texture;}
set{ _texture = value;}
}

public Entity(Texture2D texture, Vector2 position)
{
Position = position;
Texture = texture;
}
}
c#
class Entity
{
// Auto Property
public Vector2 Position {get; set;}

// Backing Field
private Texture2D _texture;

// Property with Backing Field
public Texture2D Texture
{
get{ return _texture;}
set{ _texture = value;}
}

public Entity(Texture2D texture, Vector2 position)
{
Position = position;
Texture = texture;
}
}
19 replies
CC#
Created by Ahata on 11/18/2024 in #help
Inheritance
He calls the base constructor in his first example so I guess it was a omission. The code won't even compile without. The following works as expected.
c#
using System;

public class Program
{
public static void Main()
{
Base baseObject = new Child("Value for base", "Value for child");

Console.WriteLine(baseObject.BaseProperty);
}
}

class Base
{
public string BaseProperty { get; set; }

public Base(string baseProperty)
{
BaseProperty = baseProperty;
}
}

class Child : Base
{
public Child(string baseProperty, string childProperty) : base(baseProperty)
{
ChildProperty = childProperty;
}

public string ChildProperty { get; set; }
}
c#
using System;

public class Program
{
public static void Main()
{
Base baseObject = new Child("Value for base", "Value for child");

Console.WriteLine(baseObject.BaseProperty);
}
}

class Base
{
public string BaseProperty { get; set; }

public Base(string baseProperty)
{
BaseProperty = baseProperty;
}
}

class Child : Base
{
public Child(string baseProperty, string childProperty) : base(baseProperty)
{
ChildProperty = childProperty;
}

public string ChildProperty { get; set; }
}
19 replies
CC#
Created by Ahata on 11/18/2024 in #help
Inheritance
Would you please share a minimal example of the code, producing your problem?
19 replies
CC#
Created by Jiry_XD on 11/1/2024 in #help
Reset identity colums EF Core error.
I mean SeedTableX().
17 replies
CC#
Created by Jiry_XD on 11/1/2024 in #help
Reset identity colums EF Core error.
Maybe try to create a new dbContext just before your seed methods? Because the error sounds a bit like efCore getting confused. But I'm just guessing here.
17 replies
CC#
Created by Jiry_XD on 11/1/2024 in #help
Reset identity colums EF Core error.
Ohh sorry I somehow assumed it was for tests.
17 replies