.net

.Net Extension Methods vs Utility Classes

Duplicate of about 20 recent questions; someone please link them. For simple scenarios when should i use one or the other? What are the pros & cons? What are the recommendations for using extension methods? EDIT: Let me give an example. Lets say i have a web relative path represented as a string. Now i want to write a method which...

Animated GIF in ImageList / TabPage

I'd like to show an animated GIF as the tab image on a TabPage. If I add my image to an ImageList and use the TabPage.ImageIndex property, it only shows the first frame (and doesn't animate): ImageList imageList = new ImageList(); imageList.Images.Add(Properties.Resources.my_animated_gif); tabControl.ImageList = imageList; tabPage.Ima...

IronPython - Convert int to byte array

What is the write way to get the length of a string in Python, and then convert that int to a byte array? What is the right way to print that to the console for testing? ...

Singleton, Logging and Global Settings - Good or Bad implementation?

I've got a logging class which requires need to be called from almost everywhere in the application. However it requires setup in the beginning of the application with "which path to write", "log level" and if it's "enabled" or not. I don't want to give this parameters every time or pass Logging class as parameter to every single objec...

Assembly Redirection not working as expected

I am trying to introduce Strong Signing in my project assemblies. My project output is persisted in XML and a type is mentioned (before signing) as: typestr="XYZ.PQR, MyWidget, Version=1.0.2406.20198, Culture=neutral, PublicKeyToken=null" After all the assemblies are signed with public-key with token, 622edca63ee1770c. I have introd...

WAS hosting a WCF service with net.tcp binding

I'm trying to publish a calculation service on a bunch of computers which will be used by an application server. The calculation servers are stateful and need to be able to perform asynchronous callbacks so I want to use per-session settings via TCP. The service application was built using the WCF Service Application project type in VS2...

How to integrate/mix managed and unmanaged code

Hi there is project already devoloped using unmanaged code. now in a small module to use SQLSMO in C++ i hav used managed code.Now the problem is how to integrate manged code with unmaged code... can any body help me in this regard with small exampe... if u do this u help me a lot Thanks in advance.... ...

How to replace sqlDMO with SQLSMO in c++

Is Managed code is the only way to use sqlsmo. Can ay body help me ...

Creating an Infragistics Edit Template using code

Hi, We currently use Infragistics grid and we don't bind our datasets until run time, and then setup the grid settings in code. This seems a bit long winded, but its the way our senior developer wants it done. I would like to look into using the edit template and I was wondering if there was a way of auto generating an edit template f...

Should interop assemblies be signed?

We have a set of COM components developed in VC++. When a reference to such component is added to a .NET project Visual Studio generates an interop assembly. We have a set of such assemblies now. While running our daily build we sign all the produced binaries with a digital signature. Interop assemblies are not signed since we don't fee...

Text is not visible in Textbox when focus is set

When I load my form the focus is set on first control which is textbox. the data is not fully visisble in the textbox. this problem happens to textbox only and when the focus is set on first time.if someboy know abt the solution then pls let me know. ...

Linq2SQL dealing with inserts/deletes on table with unique constraints

Hi I have a table that looks like the following: TABLE Foo { Guid Id [PK], int A [FK], int B [FK], int C [FK], } And unique constraint over A, B and C. Now say for example, you insert a row with a fresh PK with with A = 1, B = 1, C = 1. SubmitChanges(), all happy. Now you edit the table. You remove the previous entry, and...

Transform pixel height of image to printing size used by graphics object

As part of a print procedure of my application I'm trying to print a list of images scaled down to a specified width and placed one below the other. The problem is I can not figure out how to transform the height in pixels of the images to the height in the units used by the graphics object during printing. How do I calculate the imageHe...

Synchronous calculation-heavy method call that doesn't prevent redrawing

Newbie C#/.NET threading question here: Is it possible to have a synchronous (if that's the right term) method that doesn't return until it has finished some calculation but at the same time doesn't prevent the app from getting redrawn or going to "Not responding". I guess the answer is probably threads but how does one make them part ...

n-Tiered .NET application localization guidelines

I would like to get some of your ideas about resource name / categorizing place of resources Let me just give you the scope of the application: 3 or more supported languages 3 MVC websites [with a lot of shared resources, and also some unique resources] 1 shared MVC extensions library 1 core business library, which has shared func...

Few questions about Code Access Security

Hi I bought a book on Amazon which was meant to prepare me for 70-536 exam. I found there a handful of information which is a bit confusing for me. Let me quote it - I will place my questions inline. To understand how security policies are used, consider an application developer who wants to play with an assembly she downloade...

.Net CF Running Thread for lifetime of an application

Hello, I am developing a .Net Compact framework application in C# which utilises some third party message queuing software installed on the device. I am fairly new to this environment and was wondering if I could run a few key concepts of the architecture past some wiser eyes to see if I am on the right track or how it could be improved...

Setting CultureInfo on wcf service calls?

I have a WCF service running that needs to parse some data. It turns out that data (points, sizes) gets converted differently in different CultureInfo's and the parsing is spread out in a lot of classes and methods. Since all the parsing is done without passing any CultureInfo the success of the parsing is dependant of the threads cultur...

Assembly Evidence

Hi What is the purpose of the following piece of code?: object[] hostEvidence = {new Zone(SecurityZone.Internet)}; Evidence internetEvidence = new Evidence(hostEvidence, null); AppDomain myDomain = AppDomain.CreateDomain("MyDomain"); myDomain.ExecuteAssembly("SecondAssembly.exe", internetEvidence); As far as I know the CLR automatic...

xsd validation againts xsd generated class level validation

In my project I have very big XSD file which i use to validate some XML request and response to a 3rd party. For the above scenario I can have 2 approaches 1) Create XML and then validate against give XSD 2) Create classes from XSD with the help of XSD gen tool, add xtra bit of attirbutes and use them for validation. Validation in the...