Kushiwushi
Kushiwushi
CC#
Created by Kushiwushi on 1/21/2025 in #help
Cannot implicitly convert int to string
C#
foreach (var kv in json["lines"]) // there might be a faster way to do this? looks like this algo is On^ NO ITS NOT
{
Dictionary<string, int> lyricMap = new Dictionary<string, int>();
string words = kv.words;
int timeList = kv.startTimeMs;
lyricMap.Add("words", timeList);
{
string wordMap = lyricMap["words"];
}
}
C#
foreach (var kv in json["lines"]) // there might be a faster way to do this? looks like this algo is On^ NO ITS NOT
{
Dictionary<string, int> lyricMap = new Dictionary<string, int>();
string words = kv.words;
int timeList = kv.startTimeMs;
lyricMap.Add("words", timeList);
{
string wordMap = lyricMap["words"];
}
}
I'm trying to assign a variable to the "words" in the hashmap but for some reason apparently its an integer?
4 replies
CC#
Created by Kushiwushi on 1/16/2025 in #help
Cannot apply indexing with [] to an expression of type 'int'
I am trying to convert an array string to an int array and try to access certain indexes
c#

string words = kv.words;
string timeList = kv.startTimeMs;
string[] timeMs = timeList.Split(", ");
int[] time = Array.ConvertAll(timeMs, int.Parse);
foreach (int yes in time)
{
int x = 0;
Console.WriteLine(yes[0]);
x++;
}


c#

string words = kv.words;
string timeList = kv.startTimeMs;
string[] timeMs = timeList.Split(", ");
int[] time = Array.ConvertAll(timeMs, int.Parse);
foreach (int yes in time)
{
int x = 0;
Console.WriteLine(yes[0]);
x++;
}


I can't access the index as I have tried on line 9 ty ^^
20 replies
CC#
Created by Kushiwushi on 12/13/2024 in #help
Ending of curly braces results in an error?
No description
13 replies
CC#
Created by Kushiwushi on 10/24/2024 in #help
✅ NuGet package doesn't exist in current context
No description
96 replies
CC#
Created by Kushiwushi on 4/6/2024 in #help
✅ How to create new cs and csproj files?
No description
20 replies
CC#
Created by Kushiwushi on 12/20/2023 in #help
How do I use a string from one class to another?
c#
using System;
using System.Net.Http;
using System.Threading.Tasks;

public class Keys {
public static void Main (string[] args) {

public string APIKey = "Key";

public string URL = $"example.com/key={APIKey}";

}
}

class Call {
static async Task Main(string[] args) {
using (HttpClient client = new HttpClient()) {
HttpResponseMessage response = await client.GetAsync(Keys.URL);
string result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}

}
}
c#
using System;
using System.Net.Http;
using System.Threading.Tasks;

public class Keys {
public static void Main (string[] args) {

public string APIKey = "Key";

public string URL = $"example.com/key={APIKey}";

}
}

class Call {
static async Task Main(string[] args) {
using (HttpClient client = new HttpClient()) {
HttpResponseMessage response = await client.GetAsync(Keys.URL);
string result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}

}
}
with something like this, how can I use
URL
URL
which is on
Keys
Keys
unto
Call
Call
?
7 replies