.net

Custom app.config Config Section Handler

What is the correct way to pick up the list of "pages" via a class that inherits from System.Configuration.Section if I used a app.config like this? <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="XrbSettings" type="Xrb.UI.XrbSettings,Xrb.UI" /> </configSections> <XrbSettings> <pag...

Trying to make sense of Postgres' binary copy format in C#

Consider the following text from the PostgreSQL documentation on binary copying: 11-byte sequence PGCOPY\n\377\r\n\0 — note that the zero byte is a required part of the signature. (The signature is designed to allow easy identification of files that have been munged by a non-8-bit-clean transfer. This signature will be ch...

Why does the C# compiler explicitly declare all interfaces a type implements?

The C# compiler seems to explicitly note all interfaces it, and its base classes implement. The CLI specs say that this is not necesary. I've seen some other compilers not emit this explicitly, and it seems to work fine. Is there any difference or reason the C# does this? The MSIL that the C# at the bottom generates for B is: .class pr...

A nicer way to handle null references in a object hierarcy

I’m looking for a nice way to handle a null reference in object hierarchy. ie: if(null == Object1.Object2.Object3.Property) This example will throw a Null Reference exception if say Object2 is null. In my case I don't care what is null, just that something is. I don't really want to put try/catches around each place that I want to d...

How do I see a disassembly of the machine code generated by the .net JITer?

How do I see a disassembly of the machine code generated by the .net JITer? The Show disassembly window menu option is no where to be found. Even the tool bar button for it is in the disabled state. If I recall correctly the disassembly can indeed be seen but one must resort to some trick, unfortunately I don't remember what that trick w...

How to change XmlSchemaElement.SchemaType (or: difference between SchemaType and ElementSchemaType)

Hey, I'm working on a XML Editor which gets all his information from the corresponding XSD file. To work with the XSD files I use the System.Xml.Schema Namespace (XmlSchema*). Because of an 'xsi:type' attribute in the XML I've to change the XmlSchemaType of an XmlSchemaElement. Until now I use in my code the 'ElementSchemaType' property...

With WPF, how to collapse a TextBlock depending on the content of its child TextBlock?

Hello, I have to display a big list of properties/values. My issue is that there aren't values for all these properties, so I would like NOT to display these in that case. It will be easier to understand my problem with some code: <StackPanel DataContext=...> <TextBlock>Info1:<TextBlock Text={Binding Path=Info1} /></TextBlock> <TextBl...

Anyone know of a good .Net Chess Engine

I'm looking for a decent .Net chess engine. If there is a good chess existing one, any recommendation as to a good candidate to port to .Net? ...

Using Codedom to write VB.Net Properties

Looking at the example code on MSDN: This ' Declares a type. Dim type1 As New CodeTypeDeclaration("Type1") ' Declares a constructor. Dim constructor1 As New CodeConstructor constructor1.Attributes = MemberAttributes.Public type1.Members.Add(constructor1) ' Declares an integer field. Dim field1 As New ...

Calling a method when a tree node is clicked in the Standard ASP.NET 2.0 TreeView

I have a treeview which i populate dynamically using an XML Datasource. The leaf nodes in the TreeView attempt to open a URL in an iframe within the page. This all works fine, but i would like the iframe to be hidden until the point the leaf node is selected. Does anyone know what event is triggered when the nodes are clicked?? I trie...

.Net Full Text Search Library

I posted a question yesterday about using Nhibernate search with nhibernate v2 and have recieved no responses. This has confirmed to me that I need to reconsider using NHibernate.Search and look at an alternative full text search solution. I want to be able to index and search documents and display the relevant extracts of the documents ...

What is the best way to modify a list in a foreach?

Hello, a new feature in C# / .NET 4.0 is that you can change your enumerable in a foreach without getting the exception. See Paul Jackson's blog for info on this change. So I'm asking: what is the best way to do this: foreach(var item in Enumerable) { foreach(var item2 in item.Enumerable) { item.Add(new item2) } } ...

format code from ide ( VS2008)

Every once in a while I will paste in some code and it will lose all its tabs and look pretty bad I know that in the vs2008 xml viewer there is a button to format(indent) all the code to the correct hierarchy Is there such a function or macro or shortcut key that i could apply this to a section of code (or to all the code in that windo...

What is Application Domain in .NET and what is its need?

Duplicate: What is AppDomain What is Application Domain in .NET and what is its need? See Also: Usage of AppDomain in C# ...

Mapping a ternary association with FluentNHibernate, using IDictionary<TKey,TValue>

I'm trying to map a ternary association using FluentNhibernate. I have 3 tables: TUser(PK int id, string name, ...) TGroup(PK int id, string name, ...) TRole(PK int id, string name, ...) And a 4th one that associates them, representing the ternary association: TUserGroupRole(FK int userid, FK int groupid, FK int roleid) Basicall...

PEVerify MD Error: 0x8013124C

Hi I get this 'error' when running PEVerify on a custom generated assembly. [MD](0x8013124C): Error: Method has a duplicate, token=0x06000023. [token:0x06000021] [MD](0x8013124C): Error: Method has a duplicate, token=0x06000021. [token:0x06000023] Besides this (and 196 others of the...

XmlSerializer: remove unnecessary xsi and xsd namespaces

Is there a way to configure the XmlSerializer so that it doesn't write default namespaces in the root element? What I get is this: <?xml ...> <rootelement xmlns:xsi="..." xmlns:xsd="..."> </rootelement> and I want to remove both xmlns declarations. Duplicate of: How to serialize an object to XML without getting xmlns=”…”? ...

How can I validate wpf bindings are going to real properties?

I would like a simple way to ensure that all bindings I've declared in my xaml files go to real properties. Even better, I'd like to instantiate my wpf window in a unit test and call a method to ensure that the bindings are correct. Unfortunately, wpf doesn't even throw an exception if I have something wrong. That leaves me the burden...

Forcing an a web app to use .net framework 1.1

We have a web app depending on the installation of .net framework 1.1. If the user install .net framework 2.0 as an add on or if the user only has .net framework 2.0 installed, certain functionalities are broken resulting in an errormessage starting with :" Message: Request for the permission of type 'system.net.WebPermission,System, Ve...

.Net Performance/Event Monitoring

I'm looking to do both event tracking/monitoring from applications (i.e. real-time business metrics being emit from applications) and general performance monitoring (i.e. CPU usage, mem Usage etc...). I'd like to be able to have the metrics collected to a central location where they could be reported on etc... Also I'd like to be able to...