c# Programming Glossary: init
Performance difference for control structures 'for' and 'foreach' in C# http://stackoverflow.com/questions/1124753/performance-difference-for-control-structures-for-and-foreach-in-c-sharp list cil managed Code size 49 0x31 .maxstack 1 .locals init object V_0 valuetype mscorlib System.Collections.Generic.List`1.. 'array' cil managed Code size 27 0x1b .maxstack 2 .locals init object V_0 object V_1 int32 V_2 IL_0000 ldarg.0 IL_0001 stloc.1..
No output to console from a WPF application? http://stackoverflow.com/questions/160587/no-output-to-console-from-a-wpf-application you actually call any Console.Write methods. That will init the Console to work properly without changing the project type..
When using object initializers, why does the compiler generate an extra local variable? http://stackoverflow.com/questions/1679780/when-using-object-initializers-why-does-the-compiler-generate-an-extra-local-va using object initializers why does the compiler generate an extra local variable.. a question on SO yesterday I noticed that if an object is initialized using an Object Initializer the compiler creates an extra.. string args cil managed .entrypoint .maxstack 2 .locals init 0 class ClassLibrary1.Class1 class1 1 class ClassLibrary1.Class2..
combining two lamba expressions in c# http://stackoverflow.com/questions/1717444/combining-two-lamba-expressions-in-c-sharp ctor NewExpression Walk lie.NewExpression var inits lie.Initializers.Select init new Original init NewArgs.. Walk lie.NewExpression var inits lie.Initializers.Select init new Original init NewArgs Walk init.Arguments .ToArray.. var inits lie.Initializers.Select init new Original init NewArgs Walk init.Arguments .ToArray if ctor null inits.Any..
Does using “new” on a strict allocate it on the heap or stack? http://stackoverflow.com/questions/203695/does-using-new-on-a-strict-allocate-it-on-the-heap-or-stack a parameterless one. It makes sense for C# to treat the initialize a value with zeroes as a constructor because it keeps.. what you're going to do with the value after you've initialized it. The IL used for Guid localVariable new Guid someString.. bits such as nops .class public auto ansi beforefieldinit Test extends mscorlib System.Object Removed Test's constructor..
foreach vs someList.Foreach(){} http://stackoverflow.com/questions/225937/foreach-vs-somelist-foreach the other. First type List string someList some way to init foreach string s in someList process the string Other Way List.. the string Other Way List string someList some way to init someList.ForEach delegate string s process the string I suppose..
What really happens in a try { return x; } finally { x = null; } statement? http://stackoverflow.com/questions/421797/what-really-happens-in-a-try-return-x-finally-x-null-statement static int32 Test cil managed .maxstack 1 .locals init 0 int32 CS 1 0000 L_0000 call int32 Program SomeNumber L_0005..
Using a self-signed certificate with .NET's HttpWebRequest/Response http://stackoverflow.com/questions/526711/using-a-self-signed-certificate-with-nets-httpwebrequest-response 0xYY .... summary Somewhere in your application's startup init sequence... summary void InitPhase Override automatic validation..
All possible C# array initialization syntaxes http://stackoverflow.com/questions/5678216/all-possible-c-sharp-array-initialization-syntaxes possible C# array initialization syntaxes Can you list all possible array init. syntax.. initialization syntaxes Can you list all possible array init. syntax that is possible with c#. It gets really confusing to.. c#. It gets really confusing to know when it is an array initializer or a seperate declaration. Note I've searched the MSDN..
Where and why use int a=new int? http://stackoverflow.com/questions/5746873/where-and-why-use-int-a-new-int managed .entrypoint Code size 15 0xf .maxstack 1 .locals init 0 int32 A 1 int32 B 2 int32 C IL_0000 nop IL_0001 ldc.i4.0 IL_0002.. end of method Program Main As you can see first one just initialize it and second one is just the same and third one initialize.. it and second one is just the same and third one initialize and set to 100 . As for the IL code generated they both..
Itextsharp: Adjust 2 elements on exactly one page http://stackoverflow.com/questions/7590071/itextsharp-adjust-2-elements-on-exactly-one-page SearchOption.TopDirectoryOnly Standard iTextSharp PDF init using FileStream fs new FileStream outputFile FileMode.Create.. probably document.SetMargins 0 0 0 0 Declare here init in loop below iTextSharp.text.Image pageImage Loop through..
Why are RijndaelManaged and AesCryptoServiceProvider returning different results? http://stackoverflow.com/questions/957388/why-are-rijndaelmanaged-and-aescryptoserviceprovider-returning-different-results same Mode Padding BlockSize KeySize. I am using the same init vector key and data. Using the RijndaelManaged produces an encrypted..
Click events on Array of buttons http://stackoverflow.com/questions/11061675/click-events-on-array-of-buttons use them in this context if you need protected void Page_Init object sender EventArgs e var s Enumerable.Range 1 10 foreach.. Microsoft recommends to create dynamic controls in the PreInit event or in case you are using a master page in the Init event.. event or in case you are using a master page in the Init event source Edited protected void Page_Load object sender EventArgs..
Cast to Anonymous Type http://stackoverflow.com/questions/1409734/cast-to-anonymous-type it as a datasource for a WinForm BindingSource public void Init var option1 new Id TemplateAction.Update Option Update..
Add ScriptManager to Page Programmatically? http://stackoverflow.com/questions/183950/add-scriptmanager-to-page-programmatically The control collection cannot be modified during DataBind Init Load PreRender or Unload phases. Is there another way to add.. I was able to get this to work by using the Page's Init event protected override void OnInit EventArgs e Page.Init delegate.. by using the Page's Init event protected override void OnInit EventArgs e Page.Init delegate object sender EventArgs e_Init..
Possible to calculate MD5 (or other) hash with buffered reads? http://stackoverflow.com/questions/2124468/possible-to-calculate-md5-or-other-hash-with-buffered-reads TransformFinalBlock methods to process the data in chunks. Init MD5 md5 MD5.Create int offset 0 For each block offset md5.TransformBlock..
Mono Compiler as a Service (MCS) http://stackoverflow.com/questions/3407318/mono-compiler-as-a-service-mcs get set Then...make sure Reset is called at least once in Init static void Init Init new string 0 Reset And finally in ParseString.. sure Reset is called at least once in Init static void Init Init new string 0 Reset And finally in ParseString simply don't.. Reset is called at least once in Init static void Init Init new string 0 Reset And finally in ParseString simply don't reset..
Global hotkey in console application http://stackoverflow.com/questions/3654787/global-hotkey-in-console-application class Program static void Main string args new Hud .Init args class Hud int keyHookId public void Init string args SetupHotkey.. new Hud .Init args class Hud int keyHookId public void Init string args SetupHotkey InitPowershell args Cleanup private.. int keyHookId public void Init string args SetupHotkey InitPowershell args Cleanup private void Cleanup HotKeyManager.UnregisterHotKey..
Can't instantiate a COM object written in C# from VBA (VB6 ok) http://stackoverflow.com/questions/375457/cant-instantiate-a-com-object-written-in-c-sharp-from-vba-vb6-ok ProgId Test9.COMINT public class TestComClass public void Init string userid string password MessageBox.Show string.Format.. Dim o As Object Set o CreateObject Test9.COMINT o.Init A B End Sub This exact same code called from VBA in Excel gives..
Mock HttpContext.Current in Test Init Method http://stackoverflow.com/questions/4379450/mock-httpcontext-current-in-test-init-method HttpContext.Current in Test Init Method I'm trying to add unit testing to an ASP.NET MVC application.. inherits from a base class which has the following TestInitialize public void Init ... Inside this method it calls a library.. class which has the following TestInitialize public void Init ... Inside this method it calls a library which i have no control..
WPF MVVM Modal Overlay Dialog only over a View (not Window) http://stackoverflow.com/questions/6351612/wpf-mvvm-modal-overlay-dialog-only-over-a-view-not-window partial class ModalDialog UserControl public ModalDialog InitializeComponent Visibility Visibility.Hidden private bool _parentWasEnabled.. runs once summary static ModalDialogViewModel InitTranslations summary Fills the default translations for all.. not thread safe per se summary private static void InitTranslations _translations new Dictionary DialogMode string..
Setting the httpcontext current session in unit test http://stackoverflow.com/questions/9624242/setting-the-httpcontext-current-session-in-unit-test use it within your unit tests I call this within my Test Init method HttpContextFactory.SetCurrentContext GetMockedHttpContext..
|