There's nothing to be gained from adding a new String.GetRandomString() instead of StringEx.GetRandomString(), whereas making myString.IsNumeric()` appear to be an instance method, instead of StringEx.IsNumeric(string), helps the syntax be more uniform and standard.
> System.Span<T> is a new value type at the heart of .NET. It enables the representation of contiguous regions of arbitrary memory, regardless of whether that memory is associated with a managed object, is provided by native code via interop, or is on the stack. And it does so while still providing safe access with performance characteristics like that of arrays.
The reason I suspect performance is bad is because you can't use pointers and generics together. But with the ref stuff going on, it might not need to do so
Yeah, he's talking about pointers. You bring up using an interface?
Also, you need pointers for the same reason you need high performance code. Which means you likely wont need it 99% of the time. But when you do, you need them.
@Squirrelkiller Not sure what your point is. Interfaces are a useful tool in C# for a wide variety of uses across the system. Pointers are for very specialized tasks.
No, I think you misunderstood me. Let's say, you have code which requires high-performance memory manipulation. Using managed byte[] simply doesn't cut it, and profiling shows that this can be improved with unmanaged code.
You would then replace that specific chunk of code with unsafe pointers, but only in that conceptually encapsulated part of your system. It's not something you won't go making your entire project unsafe, or start using pointers for regular tasks.
var xDocument = XDocument.Load(...);
var children = xDocument.Root.Descendants("child"); // gives you all child nodes
var child = children.FirstOrDefault();
Oh wait, direct descendants, I think I know what you mean
To find direct descendants, you use .Element/.Elements, to find any descendant you use .Descendants
@Wietlol XPath is a bit finicky, but the issue is the namespace. You need to prefix child with the namespace somehow. I don't remember how you do it if it's a global namespace.
I'm loading a string to an XML document that contains the following structure :
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Include="clsWorker....
to complete the code to solve a problem.That problem is generating a map of steps for a character that moves left and right and forward .The c# code generates the number of cells where the character didn't moved and I need to find the smallest square that includes all the area where the character moved
and if I find that solution then I go to the next level of the problem and have a better view of my problem and can complete in java the code that is not working
since it becomes confusing if we mean plain Java or other Java, we call plain Java Java (because that is what everyone calls Java) and the other, we call Jaba
Is there a design pattern where a class has different members? I'm creating a filter class that can have only one of these three options; (1 or more AccountType) OR (1 or more IDs) OR (1 or more Names). I'd like to be able to have one function that takes one of these three filters.
it's a runtime error,I compile it online and the error is Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index....
prog.cs(122,49): error CS1061: Type System.Collections.Generic.List<int>' does not contain a definition for Length' and no extension method Length' of type System.Collections.Generic.List<int>' could be found. Are you missing an assembly reference?
Help! I'm looking for a verb to use in the beginning of this sentence: I (witnessed?) the rise and fall of some JavaScript libraries. (off course I didn't) I think there's a verb more powerful than witnessed
I've seen things you people wouldn't believe. Servers on fire off the shoulder of Redmond. I watched JavaScript libraries glitter in the dark near the Mozilla offices. All those moments will be lost in time, like tears in rain. Time to die.
If you dont mind it being simple, make a new class, give it 2 properties, a readonly list and a selected item
give it 2 more functions, one which sets the selected item to the given index and one that does the same but then with the given element
(these cannot be overloads)
user5500750
I think SelectList Class does what I am looking for. But there isn't that many examples and it is in the System.Web.Mvc I am not sure whether I could use that in a WPF app.