How to check that current type (object of Type) has needed interface (or parent type)
I've a some type (object of Type). Need to check that this type has interface IList. How I can do this? ...
I've a some type (object of Type). Need to check that this type has interface IList. How I can do this? ...
For a new web application project using .NET, an existing library (written in C#) will be made available online which performs some calculations on information in a data model. The library needs to be accessed by many users at the same time. Every user will work with a different set of data. Users also can modify model data and repeat t...
Hi, I have a report which has a table to which I keep adding records but there is a certain place I want to check how many lines are still left on the print page and if its below a certain amount I want it to continue on the next page. Can anyone please tell me how to check the number of lines left and also how to tell the report to st...
I have a dialog based application in which I will delegating the I/O operation read write to different thread. I just want to clear is there any difference between two approaches.. First approach: ( I am doing this in ,my main form -Form.cs) delegate void Action(); Action _action = new Action(Method); this.BeginInvoke(_action); Seco...
Currently to run windowsservice as a fixed user we set the logon properties on the windows service (where we specify the username and password to run as). but iam willing to have this feature of running the windows service as a fixed user as impersonation in web application mentioned in the config file. kindly throw your thoughts on t...
On a single view I will have three sets of paged data. Which means for each model I will have The Objects The Page Index The Page Size My initial thought was for example: public class PagedModel<T> where T:class { public IList<T> Objects { get; set; } public int ModelPageIndex { get; set; } public int ModelPageSize { ge...
I have a list of int values: List<int> histogram; How do I normalize all values so that the max value in the list is always 100? ...
I have a WPF MVVM application. In the View I have a multiselect ListBox. In the ViewModel I have a property for the selected items in the List. Using a technique similar to the one in the answer to this question I can bind my property to the ListBox. But I also want to do data validation via IDataErrorInfo. All I want to do is check th...
Hello everyone, I am using C# + VSTS2008 + .Net 3.0 to do XML serialization. The code works fine. Here below is my code and current serialized XML results. Now I want to add two additional layers to the output XML file. Here is my expected XML results. Any easy way to do this? I am not sure whether NestingLevel could help to do this. I...
I notice that a lot of desktop apps ( such as Firefox, Google Chrome, VS 2008 etc) have a crash dump that can be sent to the software vendors for analysis purpose. I am intended to create such a crash dump myself. I am doing .Net What are the best practices when comes to what data to collect, so that the data collected is just enough to...
Hello. I need a tool to decompile obfuscated .NET code. Yes, I know about Reflector and its plugins (FileDisassemble, FileGenerator). But they create VS project which won't compile. For an example the decompiled code contains: private sealed class d__0 : IEnumerator, IEnumerator, IDisposable { private int <>1...
I am working with C#.net and also SQL Server 2008. I have the following error, when trying to run a test unit within my project. System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.. Database Table Column Name: createddate Type: datetime Default Va...
I'd like to use a RichTextBox to display some text in the start page of my WinForms application, as follows: richTextBox1.Rtf = @"{\rtf1\pard\fs40 Hello World\par }"; The RichTextBox ignores my font-size directive (\fs40). It works in both Word and WordPad. What am I doing wrong? ...
Dim xml = <Root> <Parent id="1"> <Child>Thomas</Child> </Parent> <Parent id="2"> <Child>Tim</Child> <Child>Jamie</Child> </Parent> </Root> Dim parents = xml.Elements In this case, children includes all the Parent elements and all of the...
Hi everyone, I'm working on a project which needs some third party components prequisites to be installed before installing my .NET Application. Can someone tell me how to do it ?? I'm using .NET prequisites components to install the components like (.NET Framework 3.5,Windows installer 3.1,Crystal Reports) but what if i have some third...
Dim names() As String = {"one", "two", "three"} Dim xml As XElement = Nothing For Each name In names If xml Is Nothing Then xml = New XElement(name) Else xml.Add(New XElement(name) End If Next The above code will create something like this: <One> <Two /> <Three /> </One> What I need is something like this: ...
Hi, I have a problem with a data collection wizard. My wizard has a number of client side validators, (regex, required field etc.) and they all work fine. I have just added a CustomValidator to one of the controls, that is calling some server side code. (unfortunaltely it does have to be server side). My problem is that this code see...
Here I have used some .css style for my asp.net webpage. It is displaying nice in firefox and chrome and not in Internet Explorer. css code: body { margin: 0; padding: 0; } #main { width:auto; } #left { margin:0; padding: 0; float:left; } #right { margin:0; padding: 0; } #video { margin:0; padding: ...
I'm trying to parse a fragment of a stacktrace, which looks pretty much like this: at Test.Test1() in C:\Projects\Project\Test.cs:line 37 Using a regex like this works as intended: at (.*?) in (.*?):line (\d*) This matches Test.Test1() C:\Projects\Project\Test.cs 37 This regex is hardcoded to an english stacktrace, so there are...
In my C# web application, I manage switching between http and https pages in code as follows: if (pageSettingsInfo.RequiresSSL) { if (!HttpContext.Current.Request.IsSecureConnection) { HttpRequest request=HttpContext.Current.Request; string url = request.Url.ToString().Replace(request.Url.Authority, request.UrlRefe...