C# is a multiparadigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.
0
votes
0answers
6 views
My implementation of lexicographic permutation in F# is 3x slower than C#?
Can someone help me with the following micro optimization for the f# code for lexicographic permutation?
I have code in C#, which runs 0.8s. As a learning practice, I translated it into F#. However ...
1
vote
1answer
15 views
XML to Windows.Forms.Keys List
It took me a lot of poking around and unit testing to get the code to look like it is right now. So I have a XML file which in part looks like this
<FunctionKeys>
...
4
votes
2answers
57 views
Using ref for value types - Is this the right usage or is it weird at multiple levels
I chanced upon this code written by the Solution Architect for a MS CRM project and I am lost for words. Am I going crazy or is this code OK?
string returnedOptionSetStringValue=string.Empty;
int ...
3
votes
3answers
47 views
GetCommonBaseClass: Readabiliy and Functionality
I have two pieces of they which do almost the same thing. They both return the most common base class of two types. They differ in two aspect:
If one of the arguments is null, code A returns null ...
1
vote
1answer
36 views
It there a pattern used to process a same function but assign the result to a different variable regarding to a different condition?
Say I have a code snippet like this
if(string.Compare(isStandardFlag,"STANDARD",true)==0)
{
hearingID = centreSession.standardID;
centreSession.standardOutcomeID
...
5
votes
3answers
66 views
LINQ Group query - simplifying
Is there a way of writing this correctly working query more efficiently? I'm asking only to learn LINQ better:
var cpuInfo = edgeLPs
.GroupBy(k => k.CPU.ID, e => e.CPU)
...
0
votes
4answers
105 views
Proper way to execute parameterized commands within a method
This method allows for the execution of parameterized commands within a DAL class, and I tried to make it as reusable as possible. It works well but it feels a bit verbose to me. Is there a way to ...
1
vote
2answers
48 views
Insert Selected item in listbox using Ado.net and stor proc
I create this class method to Enter Selected Items Form CheckboxList to associated resource I use ADO.net & store Proc to insert data can someone help me to improve it and make to so clean instead ...
1
vote
1answer
45 views
Truncate port number from absolute Uri
We had a requirement to remove the port number from the Request.Url.AbsoluteUr i.e
Actual:
https://mysitename:443/Home/Index
Excepted:
https://mysitename/Home/Index
The code I used for ...
-1
votes
1answer
74 views
C# constants, is this right usage? [closed]
Is this the right code?
public const string Yes = "Yes";
public const string No = "No";
In which cases i should use constants instead of string, in C#
1
vote
1answer
40 views
Dynamic Treenode Creation
I am trying to create a treenode structure based on a database table for a Dungeons and Dragons character creation program I am working on. I have come up with an incredibly confusing way to do it, ...
2
votes
2answers
56 views
Sequential Execution: Orchestrator Pattern
I built a code piece that makes it easy to execute a set of sequential operations, that might depend on the same parameter value (passed across the execution) or might need a particular parameter.
...
1
vote
1answer
47 views
REST-ish API Account Controller - how's it look?
I still have to implement api keys for client auth, but so far this is what I have for users. This was built using WebAPI and SimpleMembership with Forms Auth:
Is Authenticated:
public class ...
-1
votes
0answers
30 views
Program gives to a word special numerical value. I need help to upgrade my code [closed]
Program checks each letter of the string one by one and calculates the sum of the numerical values of each letter i have applied. I need your help to not let program count value of "i" teller if it ...
1
vote
0answers
44 views
Fastest fill memory with specified 64-bit value
I need to fast fill some memory block in C#, so I wrote something like this (in Ffree Pascal COmpiler + Lazarus in 64 bit mode):
// ECX = Ptr64
// EDX = Count
// R8 = Value
PROCEDURE Fill64 (VAR ...