If there's already a way to get a List<int> of consecutive integers without a loop in C#, I don't know what it is, so I created a method for it. public static List<int> GetIntegerListFromRangeUsin... start, int end) { if (end < start) { throw new ArgumentException("Faulty parameter(s) passed: lower bound cannot be less than upper bound."); } List<int> returnList = new List<int>(end - start + 1); for(int i = start; i <= end; i++) { returnList.Add(i); } return returnList; ......
I just discovered something rather surprising. If you return a tinyint from a stored procedure as part of a dataset, and bind that dataset to a dataview, and then do something like this: <asp:Label runat="server" id="statusLabel" Text='<%# GetStatusText( (int)DataBinder.Eval(Contai... "DataItem.status")) %>'> </asp:Label> You will get an error about an invalid cast. If the stored procedure returns an int instead of tinyint, it works just fine. How can ASP.Net 3.5 not be able to ......
Be very careful when allowing Resharper to convert properties to auto-properties. In some cases it will re-initialize fields that were already initialized earlier on in the constructor. http://www.jetbrains.net/ji... ......
I recently ran into an interesting problem. I had created a data access method that used generic typing to execute a scalar SQL Server stored procedure (below), and in the stored procedure was returning SCOPE_IDENTITY() for an integer identity column. I was passing in a type of "int" to the method (as <T>) since that's what I was expecting back, but I kept getting back null. After some frustration and bewilderment I discovered that SCOPE_IDENTITY() always returns a decimal, and C# doesn't want ......
About once a day I was getting the following error from an ASP.Net web page that uses ActiveRecord: Exception Details: System.Data.SqlClient.SqlEx... A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.) I would subsequently get this error upon refreshing the page: Exception Details: System.InvalidOperationExce... ExecuteReader requires an open and available Connection. ......
If you're using telerik's RadGrid and you're seeing a message in the UI that says "Drag a column header and drop it here to group by that column" and you want to hide that message, here's what you do: myRadGrid.GroupPanel.Text = ""; This page just confused me rather than helping me: http://www.telerik.com/comm... ......
I just spent an unhealthy amount of time trying to figure out this error: Unknown server tag 'asp:ScriptManager'. I was baffled because I already had a reference to AjaxControlToolkit.dll in my project, and I had what I thought was a web.config ready to handle any AJAX requests. It turned out adding the section below to system.web fixed the problem. <pages> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extens... Version=1.0.61025.0, Culture=neutral, ......
Can anybody explain serializability to me? Can any class be made serializable, but it's just better not to for some?
I just discovered the SqlBulkCopy class in .Net 2.0, and it seems awesome! Now I don't have to shell out to BCP anymore! We'll see though, I haven't done any performance testing yet...
If you want to build your own composite control for ASP.Net and you want to create in such a way that when you set a property in the designer window, the setting is reflected in the aspx code, placing this attribute on each public property is the key:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]