Skip to content

C#

C# discussions

This category can be followed from the open social web via the handle c-065f1d12@forum.codeproject.com

93.7k Topics 383.1k Posts
  • multi tcp clients

    tutorial csharp sysadmin
    5
    0 Votes
    5 Posts
    36 Views
    D
    Thanks for help
  • 0 Votes
    6 Posts
    32 Views
    OriginalGriffO
    Now compare that against your original question and it should be obvious why it took you 8 hours to get an answer! If you give us details we can help a lot quicker! "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
  • Project structure with C# and EfCore

    csharp tutorial asp-net visual-studio sysadmin
    5
    0 Votes
    5 Posts
    28 Views
    W
    difficulties gives us new challenges and something new to learn.
  • C# Newbie, Database Programming

    database csharp visual-studio question
    11
    0 Votes
    11 Posts
    74 Views
    L
    Sorry, I did not mean to offend you. And your comments are all valid, but I just thought that they would be best posted to the OP, as follow up to what I suggested. Experience (here) tells me that not everyone reads every message in a thread; even though you and I would seem to.
  • Where To Find This DLL

    question csharp com help tutorial
    4
    0 Votes
    4 Posts
    34 Views
    RaviBeeR
    Do these links help? Bluetooth developer FAQ | Microsoft Learn[^] Windows.Devices.Bluetooth Namespace - Windows UWP applications | Microsoft Learn[^] /ravi My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
  • 0 Votes
    15 Posts
    99 Views
    D
    Well, it's obvious my one small tip offended your sensibilities, so be offended all you want. Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak
  • 0 Votes
    3 Posts
    23 Views
    M
    Thanks
  • 0 Votes
    3 Posts
    17 Views
    T
    If you think that Google always, without exception, provides useful, easily understandable guidance for a person who is new to a problem area, then you have only asked Google to be reminded of answers you already know. I have several times done serious attempts at deciphering hieroglyph explanations provided by Google, without success. Even if I tell about my googling efforts, I have had people yell back to me "Why don't you just f*** google it???" To satisfy that kind of "helpers", I would have to spend twice as much space on all details of my googling as on explaining the problem. And honestly: I believe that those spending energy on shouting "Google it!" would never spend energy on providing truly helpful assistance. When, in meatspace, I ask coworkers or friends for help with something, some information I need, they never yell back at me: "Google it!" They treat me as a friend in need of help, not as a misbehaved child. Religious freedom is the freedom to say that two plus two make five.
  • 0 Votes
    2 Posts
    9 Views
    OriginalGriffO
    When it comes to APIs you are much better off starting by talking to the people who created it - the chances that anyone on a random website has used your specific API and notices your question are vanishingly small - the API vendor should provide tech support or at least documentation and if they don't then why the heck are you using it? :D "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
  • 0 Votes
    1 Posts
    3 Views
    No one has replied
  • How to convert XML to text file

    help csharp design regex xml
    5
    0 Votes
    5 Posts
    25 Views
    OriginalGriffO
    To add to what the others say, you need to sit down and work out exactly what you expect to generate form your XML data. The reason being that XML is a text-based hierarchically structured data format, and it can be all in a single line: newlines (or any other whitespace) are not required by the XML specification, and "individual items" in XML can span multiple lines of text without any change in the data it encapsulates or an entire array of objects can occupy a single line of text - that's problem number one! The second problem is that the data contained in the XML itself doesn't "lend itself" to a flat file output - which is what an unformatted text file contains. If you look at a "basic XML" file like this example: W3Schools CD Catalog[^] you can see that what it contains isn't readily useful as a text file unless you actually convert that to a formatted file of some form. Just stripp[ing out the XML stuff doesN't give you any useful data: Empire BurlesqueBob DylanUSAColumbia10.901985Hide your heartBonnie TylerUKCBS Records9.901988Greatest HitsDolly PartonUSARCA9.901982Still got the bluesGary MooreUKVirgin records10.201990ErosEros RamazzottiEUBMG9.901997One night onlyBee GeesUKPolydor10.901998Sylvias MotherDr.HookUKCBS8.101973Maggie MayRod StewartUKPickwick8.501990RomanzaAndrea BocelliEUPolydor10.801996When a man loves a womanPercy SledgeUSAAtlantic8.701987Black angelSavage RoseEUMega10.9019951999 Grammy NomineesManyUSAGrammy10.201999For the good timesKenny RogersUKMucik Master8.701995Big Willie styleWill SmithUSAColumbia9.901997Tupelo HoneyVan MorrisonUKPolydor8.201971SoulsvilleJorn HoelNorwayWEA7.901996The very best ofCatStevensUKIsland8.901990StopSam BrownUKA and M8.901988Bridge of SpiesT'PauUKSiren7.901987Private DancerTina TurnerUKCapitol8.901983Midt om nattenKim LarsenEUMedley7.801983Pavarotti Gala ConcertLuciano PavarottiUKDECCA9.901991The dock of the bayOtis ReddingUSAStax Records7.901968Picture bookSimply RedEUElektra7.201985RedThe CommunardsUKLondon7.801987Unchain my heartJoe CockerUSAEMI8.201987 (I manually added the line breaks to prevent that showing as a single very long line!) So you need to work out what is in the XML that you are interested in, and how you will "present" that in your resulting file - otherwise it's just a waste of your time and effort! "I have no idea what I did, but
  • 0 Votes
    2 Posts
    14 Views
    OriginalGriffO
    This is the wrong place to post this as thsi forum is for C# discussions - try the Free Tools Discussion Boards[^] instead. "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
  • 0 Votes
    15 Posts
    101 Views
    J
    Hello I am back. I have tried but I am glad because I found solution. namespace DeafMan1983.Interop.Runtime.Utilities; using System; public static unsafe class UtilitiesForUTF16 { /* * string from char* (UTF16) */ public static string CharPointerToString(char* ptr) { if (ptr == null) return string.Empty; int length = 0; while (ptr\[length\] != '\\0') { length++; } return new string(ptr, 0, length); } /\* \* char\* (UTF16) from string \*/ public static char\* StringToCharPointer(string input) { if (input == null) return null; char\* utf16Ptr = stackalloc char\[input.Length + 1\]; fixed (char\* inputPtr = input) { for (int i = 0; i < input.Length; i++) { utf16Ptr\[i\] = inputPtr\[i\]; } inputPtr\[input.Length\] = '\\0'; return inputPtr; } } /\* \* It works like strlen, but it uses only char\* (UTF16) \*/ public static int CharPointerLength(char\* charPtrs) { if (charPtrs == null) return 0; int length = 0; while (charPtrs\[length\] != '\\0') { length++; } return length; } } And I resolved it: 1 Test: Shows Console.WriteLine() : string string_str1 = "Hello World!"; char* char_str1 = StringToCharPointer(string_str1); Console.WriteLine($"Result: {CharPointerToString(char_str1)}"); Console.WriteLine($"Length of CharPointer: {CharPointerLength(char_str1)}"); char* char_str2 = stackalloc char[] { 'H', 'e', 'l', 'l', 'o' }; string str2 = CharPointerToString(char_str2); Console.WriteLine($"Result: {str2}"); Console.WriteLine($"Length of CharPointer: {CharPointerLength(char_str2)}"); Picture 1 And I tested with WinAPI ( TerraFX.Interop.Windows ) I have tested it and it won't show Chinese Language :D Picture 2 I am very excited to resolve it. But I don't know if It works fine. I hope it works anything if UTF16 says wrong like Chinese Fonts show up then we need add some Encoding....
  • 0 Votes
    5 Posts
    29 Views
    D
    LOL. I think that's the primary reason why I don't do C++ anymore. That and someone has to pick up my code and maintain it after I'm gone and it's easier to find a C# dev (or Java dev we can convert) than it is to find a C++ dev for the team I'm on. Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak
  • 0 Votes
    1 Posts
    9 Views
    No one has replied
  • 0 Votes
    9 Posts
    55 Views
    J
    Interesting but keep in mind that the code as written does not 'use' TLS 1.3. Rather it attempts to specify it and then backs down if the system tells says it is not available. I suspect one would also want to verify that something else is not also doing a backdown even further down the line. (Keep in mind my first post where I mention that encryption algorithms might also be needed which is only determined by the windows OS.)
  • I need to convert a the string of a Text box to a Value

    question help
    15
    0 Votes
    15 Posts
    94 Views
    J
    :thumbsup: Good news! "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
  • Command Line Arguments For IrfanView using C# WinForm

    csharp help question
    6
    0 Votes
    6 Posts
    40 Views
    D
    I didn't say I knew anything about Irfan, only that your code is unnecessarily complicated, making it harder to debug. Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak
  • 0 Votes
    4 Posts
    32 Views
    OriginalGriffO
    Check the build parameters: if your exe is 64 bit and the DLL is 32 then it can't load it, and vice versa. "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
  • 0 Votes
    22 Posts
    226 Views
    T
    I think that is one of the (few) useful extensions to C# in recent years. Religious freedom is the freedom to say that two plus two make five.