聚合问答列表
3 浏览

Serializing and Deserializing Expression Trees in C#

Is there a way to Deserialize Expressions in C#, I would like to store Expressions in a Database and load them at run time.

c#,serialization,expression-trees 2017-11-30
3 浏览

Merging two images in C#/.NET

Simple idea: I have two images that I want to merge, one is 500x500 that is transparent in the middle the other one is 150x150. Basic idea is this: Create an empty canvas that is 500x500, position th...

c#,.net,image 2017-11-30
3 浏览

How to convert a structure to a byte array in C#?

How do I convert a structure to a byte array in C#? I have defined a structure like this: public struct CIFSPacket { public uint protocolIdentifier; //The value must be "0xFF+'SMB'". public ...

c#,struct 2017-11-30
AD 友情赞助
4 浏览

Getting “type or namespace name could not be found” but everything seems ok?

I'm getting a: type or namespace name could not be found error for a C# WPF app in VS2010. This area of code was compiling fine, but suddenly I'm getting this error. I've tried removing the Proj...

c#,visual-studio-2010,namespaces,reference,directive 2017-11-30
3 浏览

Code for decoding/encoding a modified base64 URL

I want to base64 encode data to put it in a URL and then decode it within my HttpHandler. I have found that Base64 Encoding allows for a '/' character which will mess up my UriTemplate matching. The...

c#,url,base64,encode,decode 2017-11-30
3 浏览

Maximum number of threads in a .NET app?

What is the maximum number of threads you can create in a C# application? And what happens when you reach this limit? Is an exception of some kind thrown?

c#,.net,multithreading 2017-11-30
AD 友情赞助
3 浏览

How to delete an element from an array in C#

Lets say I have this array, int[] numbers = {1, 3, 4, 9, 2}; How can I delete an element by "name"? , lets say number 4? Even ArrayList didn't help to delete? string strNumbers = " 1, 3, 4, 9, 2"...

c#,.net,arrays 2017-11-30
3 浏览

Calculate the number of business days between two dates?

In C#, how can I calculate the number of business (or weekdays) days between two dates?

c#,datetime 2017-11-30
2 浏览

Calling a function from a string in C#

I know in php you are able to make a call like: $function_name = 'hello'; $function_name(); function hello() { echo 'hello'; } Is this possible in .Net?

c#,.net,php,string,function-calls 2017-11-30
AD 友情赞助
3 浏览

Why and How to avoid Event Handler memory leaks? [closed]

I just came to realize, by reading some questions and answers on StackOverflow, that adding event handlers using += in C# (or i guess, other .net languages) can cause common memory leaks... I have us...

c#,design-patterns,memory-leaks,event-handling 2017-11-30
2 浏览

How can I programmatically generate keypress events in C#?

How can I programmatically create an event that would simulate a key being pressed on the keyboard?

c#,.net,wpf,keyboard-events 2017-11-30
5 浏览

ASP.NET Identity default Password Hasher, how does it work and is it secure?

I am wondering wether the Password Hasher that is default implemented in the UserManager that comes with MVC 5 and ASP.NET Identity Framework, is secure enough? And if so, if you could explain to me h...

c#,asp.net,security,passwords,asp.net-identity 2017-11-30
AD 友情赞助
4 浏览

SQL Data Reader - handling Null column values

I'm using a SQLdatareader to build POCOs from a database. The code works except when it encounters a null value in the database. For example, if the FirstName column in the database contains a null va...

c#,sqldatareader 2017-11-30
2 浏览

Binding WPF ComboBox to a Custom List

I have a ComboBox that doesn't seem to update the SelectedItem/SelectedValue. The ComboBox ItemsSource is bound to a property on a ViewModel class that lists a bunch of RAS phonebook entries as a Col...

c#,wpf,data-binding,mvvm,combobox 2017-11-30
2 浏览

ASP.NET MVC: Custom Validation by DataAnnotation

I have a Model with 4 properties which are of type string. I know you can validate the length of a single property by using the StringLength annotation. However I want to validate the length of the 4 ...

c#,.net,asp.net-mvc,asp.net-mvc-3,data-annotations 2017-11-30
2 浏览

Most elegant way to generate prime numbers [closed]

What is the most elegant way to implement this function: ArrayList generatePrimes(int n) This function generates the first n primes (edit: where n>1), so generatePrimes(5) will return an ArrayLi...

c#,java,algorithm,primes 2017-11-30
4 浏览

How to find the Number of CPU Cores via .NET/C#?

Is there a way via .NET/C# to find out the number of CPU cores? PS This is a straight code question, not a "Should I use multi-threading?" question! :-)

c#,.net,cpu-cores 2017-11-30
3 浏览

Entity Framework .Remove() vs. .DeleteObject()

You can remove an item from a database using EF by using the following two methods. EntityCollection.Remove Method ObjectContext.DeleteObject Method The first is on the EntityCollection and the se...

c#,database,entity-framework,orm 2017-11-30
3 浏览

How to calculate the angle between a line and the horizontal axis?

In a programming language (Python, C#, etc) I need to determine how to calculate the angle between a line and the horizontal axis? I think an image describes best what I want: Given (P1x,P1y) and ...

c#,python,trigonometry 2017-11-30
2 浏览

Recommended ServiceStack API Structure

I'm trying work out the best way to structure our API; we have Reviews which we've setup in a standard REST structure (list one, list all, create, update etc). Where it doesn't quite fit the examples ...

c#,api,servicestack 2017-11-30
AD 友情赞助