text stringlengths 46 37.3k | title stringlengths 12 162 |
|---|---|
C_sharp : We 're integrating with chargify http : //www.chargify.com and I need to handle webhooks from Chargify in our MVC4/C # server.Chargify sends POST data in the ( ruby ) way - sub objects are delimited in square brackets , like so : The issue is that on the .NET side , the default model binder does not like the ... | ModelBinding : POST data ( possibly from Ruby ) in MVC4/C # |
C_sharp : I 'm using the JSONAPI specifications from jsonapi.org , then I 'm using the JsonApiSerializer to accomplish the JSONAPI specification , so my response and request body looks like : I have an entity `` Article '' it looks like : Then I 'm trying to use Swashbuckle Swagger for document my API , but in the Swag... | Add custom serializer to Swagger in my .Net core API |
C_sharp : I am using C # with RHash in order to calculate the btih hashes of of file.Currently I 'm using 3 tools in order to generate the btih hash : rhash-1.2.9-src\bindings\mono with librhash-1.2.9-win dllrhash-1.2.9-win32 command line tool uTorrentThe problem is that every tool generates different btih signatures f... | C # rhash generates hashes different than the rhash.exe and utorrent |
C_sharp : I need to declare a lot of properties of a model that all have the same attributes . I was wondering if there was any way to do this in MVC.I have a bunch of fields that use those 2 attributes ( required and range ) , The only thing differing is the name of the properties . Is there any way to declare these i... | MVC - is there a way to declare multiple properties in a model with the same attributes , different names |
C_sharp : I seem to be running into a weird issue and after hours of head scratching , I seem to have narrowed the issue down to a combination of partial classes and virtual properties . When I override a property that 's in a partial class , sitting in a separate file , MVC duplicates the fields on my view . I am usin... | MVC scaffolding is duplicating my model fields |
C_sharp : UpdateThanks to a comment by @ IvanL , it turns out that the problem is Google specific . I have since tried other providers and for those everything works as expected . Google just does n't seem to send claims information . Have n't yet been able to figure out why or what I need to differently to get Google ... | IAuthenticationResponse.GetExtension < ClaimsResponse > ( ) always returning null |
C_sharp : I have this code in visual studio that when the argument is null will not throw the exception and I can not figure out why ! Is the yield return messing with it somehow ? <code> IEnumerable < string > Method ( string s ) { if ( string == null ) { throw new Exception ( ) ; } if ( dictionary.TryGetValue ( s , o... | Method having yield return is not throwing exception |
C_sharp : From this blog post , it seems I should be able to store a DateTime as a ApplicationData.LocalSettings value , but I 'm getting the exception below for this line.https : //blogs.windows.com/buildingapps/2016/05/10/getting-started-storing-app-data-locally/ # bgpwEqDbEt0GClHB.97Exception : Data of this type is ... | DateTime in ApplicationData.LocalSettings |
C_sharp : I want to delete some worksheets from an Excel workbook . When my program is loaded , it reads the sheets in the workbook , lists them in a gridview where the user can select which sheets should be in the output file . When the user hits the save button , I delete worksheets based on the selection and save th... | Delete non-empty worksheets from excel workbook |
C_sharp : I have a variable named like allowedZHs . ZH is a domain specific acronym . ZHs is its plural form . I would like to continue using that plural form . I find it much more expressive than the `` correct '' form `` Zhs '' .I tried to tell Code Analysis this by adding a Code Analysis Dictionary . This works fine... | Make Code Analysis stop warning about a certain variable name |
C_sharp : I designed the following test : The results when null is not present : Contains False 00:00:00.0606484Any == False 00:00:00.7532898Any object.Equals False 00:00:00.8431783When null is present at element 4000 : Contains True 00:00:00.0494515Any == True 00:00:00.5929247Any object.Equals True 00:00:00.6700742Whe... | Why is Any slower than Contains ? |
C_sharp : I have inherited some code that uses the ref keyword extensively and unnecessarily . The original developer apparently feared objects would be cloned like primitive types if ref was not used , and did not bother to research the issue before writing 50k+ lines of code.This , combined with other bad coding prac... | Ref Abuse : Worth Cleaning Up ? |
C_sharp : Short question : How to setup a roslyn code analyzer project with a working unit-test project in Visual Studio 2019 v16.6.2 ? A few months ( and a few Visual Studio updates ) ago I experimented with setting up a code analyzer project using the `` Analyzer with Code Fix ( .NET Standard ) '' project template . ... | `` Analyzer with Code Fix '' project template is broken |
C_sharp : Recently , I have found out that indexer can accept an array of arguments as params : Then , you will be able to do : However , I never met such usage in .NET Framework or any third-party libraries . Why has it been implemented ? What is the practical usage of being able to introduce params indexer ? <code> p... | Practical usage of params indexer |
C_sharp : Im trying to make a function that fetches the data from my settings file ( HighscoreSaved wich is put into highscoreList array ) and then join the strings and write them into the textbox ( highScore.Text ) However when i call on the function nothing happensSo here is my code : Form1And heres the class thats s... | Windows forms different classes , trying to change textbox.text |
C_sharp : I want to plot some 3d surfaces with ILNumerics . I noticed that ILCube does not keep the shape of surface if I rotate it and it is because it tries to fit the cube in the ILPanel . If I use ILCamera , however , it will keep the shape but there is no cube around it . Here is an example , and the result isand ... | How to keep shape in ILCube |
C_sharp : In my everlasting quest to suck less I 'm currently checking out mvc Turbine to do the IoC dirty work.I 'm using the mvc Turbine nerd dinner example as a lead and things look rather logical thus far.Although I 'm refering to the turbine project here , I 'm guessing the philosophy behind it is something genera... | Where to keep things like connectionstrings in an IoC pattern ? |
C_sharp : I have a DropDownList in a project . This DropDownList contains a SelectedIndexChanged event : Is it possible to check if the index was changed in the code , like : , or if the change happened by user interaction ? <code> private void cbo_SelectedIndexChanged ( object sender , EventArgs e ) { ... ... } cbo.Se... | Dropdownlist check if index changed by code or by selection |
C_sharp : P/Invoke declarations : My code : None of the above UpdateResource calls work . They add the new resource under a new resource type named # 2 , RT_BITMAP , BITMAP instead of updating the existing resource.In the P/Invoke declaration of UpdateResource , if I overload string lpType to IntPtr lpType and pass it ... | UpdateResource does n't work with lpType as string |
C_sharp : I have a certain calculated field that I regularly want to return in the `` select '' fields of a Linq query , e.g . Customer order total this year , along with other demographic info of the Customer.Obviously , this does n't work , because TotalPurchasesThisYear has no SQL translation . But everything inside... | How to abstract a field in the Select list of a Linq query ? |
C_sharp : Consider these variants : orI can not find the difference in the returned results of the call typeof ( B ) .GetMethod ( `` Doit '' ) ; In both cases MethodInfo.DecalringType is class B and other properties seem the same.Do I miss something or there is no way to distinguish them ? Update : When I ran the sampl... | Is it possible to tell apart overridden and hidden method ? |
C_sharp : I had made a windows service in visual studio 2008 in C # . inside the service i had written only single line code then i add the project installer & change the serviceProcessInstaller1 Account property as local system Also change the serviceInstaller1 start type property as Automatic.then i build the project... | Windows Service is not Working |
C_sharp : The following program prints : Meaning that it can not acquire an exclusive lock on resource . Why ? <code> Entered 3Entered 4Wait for Exited messagesExited 3Exited 4 public class Worker { public void DoIt ( object resource ) { Monitor.Enter ( resource ) ; Console.WriteLine ( `` Entered `` + Thread.CurrentThr... | Why can not I acquire exclusive lock ? |
C_sharp : I have the following LINQ to query the database and retreive deleted products from a particular date.However , the query is retreiving values like product.ActionDate.Value = { 12/8/2016 11:41:00 AM } when the fromDate was fromDate = { 12/8/2016 11:41:00 AM } The query clearly says GREATER THAN . What is happe... | DateTime comparison in LINQ not returning correct results |
C_sharp : I am seriously stumped as I ca n't find anything on late binding an array in VBA . Is this even possible ? If yes , how ? If not - why ? Note : I do n't mind if it 's possible using a native .Net/C # types like Even though the System.Array is COM visible it seems impossible to instantiate it.Any idea how to l... | Late binding an array |
C_sharp : I have two WinForms ( Setting and frmMain ) . I have a TreeView in Setting 's form and I want to call its FillTree method in the second form frmMain.I 'm using the TreeView.Invoke for the threading purposes.Here is my code for TreeView filling data in Setting 's form : FillTree method from above code , I want... | Where should TreeView 's Invoke method between two WinForms be handled ? |
C_sharp : I have a unit test where I try to verify that I have disposed of a document that was once attached to the main user interface . The unit test has to be async in that everything needs to be run under an STA thread and I have to await the user interface being created.I have a helper that dispatches actions onto... | Am I doing something wrong combining dotMemory , xUnit and async |
C_sharp : I 'm modifying an application written in C # that makes heavy-use of multi-threading to play audio files and display images to a user . Given that it is multi-threaded , I need to use the Invoke method often to change form elements . I 'm running into a pattern that I 'm not very comfortable with , where I fi... | What is considered good programming practice in multi-threaded winform applications with delegate usage ? |
C_sharp : I have the following DataSet : The Product and Part tables can be edited using these DataGridViews : When the user double-clicks a row in the Products grid , the following form opens : The left column is supposed to list the parts associated with this product . The right column is supposed to list all the oth... | How to bind a many-to-many relation in WinForms ? |
C_sharp : I have a problem in a Portable Class Library class . It seems I can not use .AsParallel ( ) extension method although System.Linq is referenced . Here is the code : list has n't AsParallel ( ) method , it has only AsQueryable and AsEnumerable.Target frameworks are .NET 4.5 and highr , Phone 8 , Windows Store ... | Is it possible to use .AsParallel Extension Method in PCL ? |
C_sharp : I have a method in unmaged COM object which I 'm trying to marshall : But I ca n't figure out the right way to marshal out LPSTR** items . It 's supposed to be a list of items . However if try to do something like this : I only get the very first letter of the very first item and nothing else.How can I marsha... | How to marshall LPSTR** in .NET ? |
C_sharp : Hello Guys : ) I have this little problem regarding C # syntax . this is my codeThis is the Output And This Output is what i want where Time is not includedI tried this <code> listView1.Items.Add ( new ListViewItem ( new string [ ] { dr [ `` Date '' ] .ToString ( ) } ) ) ; lisView1.Items.Add ( new ListviewIte... | How to exclude time from date column |
C_sharp : I have been these options to answer this question.111102I have this simple code , I just want to know how many string objects will be created by this code . I have a doubt , Is string s = `` '' ; creates no object . I dont think so , Please make me clear.If I append string with + operator , it creates new str... | How many string objects are created by below code ? |
C_sharp : Well according to some Stack Overflow question answers , I 've read that using declaration of object inside the loop , is better than doing it outside of it , performance sided.I could not understand why , because when I use the declaration inside the loop , my software uses more RAM then the one with the dec... | Declaring variable type in a infinite loop performance ? |
C_sharp : I believe I saw somewhere an attribute that , when applied to a class , would show the value of a property in intellisense . I 'm not talking about XML comments . It looked something like this : Anyone know which Attribute I 'm talking about ? <code> [ SomeAttribute ( `` Name = ' { 0 } ' , Age = ' { 1 } ' '' ... | Attribute that displays property value in Visual Studio |
C_sharp : In my database I have the following tables : PersonPostInterestTagMany-Many relationships exist between Person-InterestTag and Post-InterestTagI need to perform a linq query in EF 4.1 to pull back any post that contains at least one interest tag that matches at least one interest tag related to the given user... | What is the most efficient way to do comparisons involving many-many relationships with LINQ in EF 4.1 ? |
C_sharp : I have an assembly which contains several UserControl objects that I want to be able to save/load via the application UI . To do this , each control implements the ISerializable interface to customize the fields they need to save.Here 's a simplified version of that library : The client application instantiat... | Deserializing into a UI |
C_sharp : I have been thinking about the IEnumerator.Reset ( ) method . I read in the MSDN documentation that it only there for COM interop . As a C++ programmer it looks to me like a IEnumerator which supports Reset is what I would call a forward iterator , while an IEnumerator which does not support Reset is really a... | Would C # benefit from distinctions between kinds of enumerators , like C++ iterators ? |
C_sharp : Why do I get an DbUpdateException - there are no further details - when I try to insert a new pupil to an existing schoolclassCode ? This is a many to many relation.Do I have to insert the pupil firstly in context.Pupils.add ( pupil ) ? I thought I can do the insert of the pupil and set into relation to a sch... | TransactionScope around Many to Many Insert with Entity Framework returns TimeoutException |
C_sharp : For example , I 'm curious if in the following code , I can be assured that either Foo ( ) or Bar ( ) will be executed.I am quite familiar with finally blocks , and do not need an explanation of that feature.I ask because the code above would not work in Java due to the existence of Throwable , which I discov... | Are Exceptions and return statements the only possible early exits in C # ? |
C_sharp : I am transforming HttpContent into the following dto : And am running some unit tests on it : And that test fails since the Content-Length header is not being captured on my dto . However if I do : The test passes and all headers are captured . Even more I also tried this : and it fails since dto does n't hav... | HttpContent Headers inconsistent enumeration |
C_sharp : This code is a simple vocabulary - translator . Can I use StringComparison.CurrentCultureIgnoreCase , so that when you type in textBox1 not taken into account to register the word you ? <code> using System.Text ; using System.IO ; using System.Windows.Forms ; namespace dс { public partial class Form1 : Form {... | Dictionary - StringComparison.CurrentCultureIgnoreCase |
C_sharp : I use the using statement for SqlConnection . It 's is good for performance because forces calling Dispose ( ) that simply releases the connection to the pool sooner.However , I realized that object created in using can not be redefined . I can not do like this : I was wondering if I can replace using , and d... | Can the using statement be replaced by curly braces ? |
C_sharp : I have a DataGridView which colors its rows when its States property is set.States is a String which represents a semicolon-separated numbers list.If I receive `` 0 ; 1 ; 2 '' the three first rows will be colored in purle , green and red respectively.The problem comes when I sort the datagrid clicking on a co... | Access DataGridView rows the order they were added |
C_sharp : I have many problem in asp.net because i am new with that . so i searched but i did not find my answer.First of all my view engine is aspx is not razor and it is my mostly problem .this is View as you so i have some item that fill the model . now my question is how i pass this view to controller ( with out Aj... | Fill the Model in view and pass it controller |
C_sharp : In the following code example the call l.Add ( s ) and c.Add ( s ) is successful , but it fails when for a generic IList < string > .https : //dotnetfiddle.net/Xll2If Unhandled Exception : Microsoft.CSharp.RuntimeBinder.RuntimeBinderException : No overload for method 'Add ' takes ' 1 ' arguments at CallSite.T... | Add dynamic to IList < T > fails |
C_sharp : The singleton pattern implementation suggested in C # in Depth is ReSharper suggests to simplify this using an auto property and the C # 6 auto-property initializer : This does indeed look simpler . Is there a down-side to using this simplification ? <code> public sealed class Singleton { private static reado... | Singleton pattern - a simplified implementation ? |
C_sharp : I 'm playing tonight with F # and redis . I 'm using ServiceStack.redis to connect to MSOpenTech redis running on localhost . For a test purpose I was trying to save price of bitcoin into redis with code like this : Unfortunately , the result from PrintDump was : Just for testing purpose , I ran nearly identi... | ServiceStack.Redis with F # is not storing data . But nearly the same code in C # works |
C_sharp : I have a problem using the Repository pattern in C # especially when I try to implement a Façade pattern too . My concept follows : When I first started the generic repository , I began with one which has all the CRUD operations in a single file ( and their related interfaces in a separate single file ) . But... | Polymorphism with generics on the repository pattern |
C_sharp : We had a discussion at work regarding locking and what exactly happens . The code that triggered this discussion is : I see this as straight-forward : look for a value in the cache , if it 's not there then get a lock so as nothing else interrupts whilst the code gets the name and stores it in the cache.Our d... | What are the implications of using lock ( typeof ( string ) ) |
C_sharp : For instance I have a methodIf I will call this method in a mannerWill my graphics object be autodisposed or I should call g.Dispose ( ) manually in the end of the method ? <code> SomeMethod ( Graphics g ) { ... } SomeMethod ( new Graphics ( ) ) SomeMethod ( Graphics g ) { ... g.Dispose ( ) ; } | Autodisposing objects |
C_sharp : Let 's say I have a well-known interface IWellKnownInterface , which is known to be COM-visible and registered.I also have a managed ( C # , to be exact ) implementation of this object : And , finally , I have an extern method , which accepts the object of this interface : Question 1 : I would like to know wh... | Working with managed COM object from unmanaged code |
C_sharp : The following code sample prints : While first two lines are as expected , why compiler selected param array for a regular array ? <code> TT [ ] T [ ] public class A { public void Print < T > ( T t ) { Console.WriteLine ( `` T '' ) ; } public void Print < T > ( params T [ ] t ) { Console.WriteLine ( `` T [ ] ... | How exactly keyword 'params ' work ? |
C_sharp : Having this code : Why this code prints `` I am an int '' and not `` I am a long '' ? <code> class Program { static void Main ( string [ ] args ) { Check ( 3 ) ; Console.ReadLine ( ) ; } static void Check ( int i ) { Console.WriteLine ( `` I am an int '' ) ; } static void Check ( long i ) { Console.WriteLine ... | c # parameter implicit conversion |
C_sharp : Below is a simple example of the difference I would like to highlight.Using coroutines : Using Update ( ) and Time.deltaTime : When should I use one as opposed to the other and what are the advantages/disadvantages of each ? <code> public float repeatRate = 5f ; void Start ( ) { StartCoroutine ( `` RepeatSome... | In Unity , when should I use coroutines versus subtracting Time.deltaTime in Update ( ) ? |
C_sharp : In docs for Microsoft C # says To change the time separator for a particular date and time string , specify the separator character within a literal string delimiter . For example , the custom format string hh ' _'dd ' _'ss produces a result string in which `` _ '' ( an underscore ) is always used as the time... | Using Apostrophe ' ' in custom format for date |
C_sharp : I am trying to connect to my workspace in the Azure Portal . I am getting the error as Operation returned an invalid status code 'Unauthorized'.The creds object has fetched the Authentication Token and I have added resource permissions to my app as mentioned in this link <code> using System ; using Microsoft.... | Unable to authorize Azure LogAnalytics Workspace |
C_sharp : I 've two for loops that basically look up in two different arrays ( each having a size around 2-4k at peak ) and set a value in a 3rd array based on these values . For some weird reason there is a factor two difference between the performance of this piece of code depending on in which order I put the two fo... | Why Does This Improve Performance ? |
C_sharp : Please , consider the following example code : Notice the difference between Test and TestAsync . This code satisfies all the assertions . I guess looking at the code with Reflector will tell me why , but still this is something I did not expect at all.Of course , changing AStruct to be a class instead of a s... | How to deal with side effects produced by async/await when it comes to mutable value types ? |
C_sharp : A simple question : I want to compare two objects using the virtual Equals ( ) method ( not == ) . Both can be null.Should I repeat this litany : or is there a more elegant idiom for such situation ? <code> if ( ( left == null & & right == null ) || ( left ! = null & & left.Equals ( right ) ) { } | C # shorthand for Equals ( ) when both args can be null |
C_sharp : NOTICEThis is a rather large question , so please bear with me and I apologize in advance if this is unclear . For the sake of making this question manageable , and to minimize confusion , I omit some properties from copy-and-pasted classes.CONTEXTI 'm writing a networked application - a 'remote desktop ' sor... | Design help for a networked application ? |
C_sharp : I want to get the most current questions from Stack Overflow using the Stacky C # library for the Stack Exchange API.I took the example code and tried to run it but it hangs when it comes to returning data from the Stack Exchange website . What am I doing wrong ? I also saw that I can register my application ... | Get Stack Overflow questions with Stacky API |
C_sharp : IL does n't always use callvirt instruction for virtual methods in a case like this : In this case , it is said that IL will produce call instead of callvirt where callvirt is produced to check whether variable is null or not and throws NullReferenceException otherwise.Why does a recursive invocation happen t... | Why does callvirt IL instruction cause recursive invocation in virtual methods ? |
C_sharp : I have a model where a place has some descriptions , those descriptions are associated with interests ( place.description.interests ) . A user looking at the view for a place is represented in the model as a user , who also has a number of interests.What I want to do is sort the description by overlapping int... | Finding Overlapping Interests in LINQ |
C_sharp : Is there a reason the built in MVC View Scaffolding in Visual Studio 2015 does not work with inherited base classes that contain a generic id ? Simple test case : Trying to create a scaffolded view ( e.g . List , Create , Edit , Delete ) using the Country entity results in the following error pop-up : There w... | MVC View Scaffolding not working with Generic base class ? |
C_sharp : I 'm writhing a web application ( ASP.Net MVC , C # ) that require the user to provide urls to RSS or Atom Feed that I then read with the following code : While debugging my application I accidentally passed /something/like/this as an url and I got an exception telling me that C : \something\like\this ca n't ... | How can I make sure a url provided by the user is not a local path ? |
C_sharp : I have a DataGridView inside a panel . The scrolling is disabled on the DataGridView but instead is done on the panel . By doing so I achieve pixel based scrolling of the DataGridView . I scroll as following : However , the problem is that after changing the scroll bar position , if I click on the DataGridVie... | DataGridView inside a panel jumps to beginning of list after panel gets scrolled |
C_sharp : Assuming these two strings : How can I programatically find that s2 is similar with s1 and replace the s2 string with the s1 string ? Thanks.Jeff <code> string s1= '' control '' ; string s2= '' conrol '' ; ( or `` ocntrol '' , `` onrtol '' , `` lcontro '' etc . ) | Using C # , how can I replace similar words ? |
C_sharp : I have a generic type that look like thisand I need to dynamically construct the type T. So that it looks like this : Can this be done ? <code> public class Entity < T > where T : Entity < T > { ... } public class MyClass : Entity < MyClass > { ... } | Dynamically create a c # generic type with self referenced constraints |
C_sharp : I am creating a stock trading simulator where the last days 's trade price is taken as opening price and simulated through out the current day . For that I am generating random double numbers that may be somewhere -5 % of lastTradePrice and 5 % above the lastTradePrice . However after around 240 iterations I ... | Multiple iterations of random double numbers tend to get smaller |
C_sharp : I have a program that uses the console and GUI for quite important aspects of my program . I presume that these two parts both use the same thread.The issue is that I 'm using a multimeter with an output , and to receive bits of data from it the program sends commands to do it - it uses SCPI , these commands ... | C # Console Thread |
C_sharp : I have two overloaded generic methods : When I try to call Foo as follows on my computer : I get no compiler errors or warnings , and the first method with the generic argument is called ( i.e . the output is T ) . Will this be the case in all C # incarnations and on all platforms ? In that case , why ? On th... | Generic method overloading and precedence |
C_sharp : I am trying to release a handle to the USB interface with CloseHandle . The exception I get is : System.Runtime.InteropServices.SEHException ( 0x80004005 ) : External component has thrown an exception . at Device.Net.APICalls.CloseHandle ( SafeFileHandle hObject ) at Usb.Net.Windows.UsbInterface.Dispose ( ) i... | C # WinUSB Ca n't Call CloseHandle on Interface |
C_sharp : I 'm having a little trouble deciding the best way to refactor a method which contains LINQ queries which are very similar but not identical.Consider a method which is something along these lines : This is just an illustration , but imagine I 'm needing to execute a different query ( different in that it uses... | Refactoring method containing LINQ queries |
C_sharp : I think async/await keywords here are redundant.Given a number of task-returning methods , is there any more straightforward way to run them in parallel and return when all are complete ? <code> Parallel.Invoke ( async ( ) = > await DoSomethingAsync ( 1 ) .ConfigureAwait ( false ) , async ( ) = > await DoSome... | Can this parallel async call be simplified ? |
C_sharp : MonoTouch advertises support for AsParallel on its website with this code snippet : However , even a trivial sample crashes my app : I know MonoTouch ca n't handle virtual generic methods but is n't PLINQ supposed to work ? What is it wrong that I am doing ? MonoTouch version is 5.3.5.Same goes for Parallel.F... | AsParallel crashing a MonoTouch app |
C_sharp : The following program will not compile : Not surprisingly , I will get the error Can not implicitly convert type 'int ' to 'byte'However , if I make x a const , then it will compile : I 'm curious as to what 's going on here . If an int can not be implicitly cast to a byte , does the compiler create a `` byte... | Why does a const int implicitly cast to a byte , but a variable int does not ? |
C_sharp : I am trying to learn MVVM and have come across a weird snag . I have a main menu with a drawer control that comes out and shows a menu : In the main window where this drawer is , I have a ContentControl where I set its content with a Binding.This window 's binding is set to a view model.and here is the ViewMo... | ContentControl Content Property not changing with hosted content |
C_sharp : While answering this question C # Regex Replace and * the point was raised as to why the problem exists . When playing I produced the following code : This has the output : B.BB.BI get that the 0 length string is match before and after the . character , but why is A replaced by 2 Bs.I could understand B.BBB.B... | Regex.Replace without line start and end terminators has some very strange effects ... . What is going on here ? |
C_sharp : Exact code I 'm trying to build : I 'm getting this error : Invalid variance : The type parameter 'T ' must be invariantly valid on 'MapLibrary.IMapContainer.GetRooms ( ) ' . 'T ' is covariant.I was under the impression that this would be valid since IEnumerable simply returns the items , and none can be adde... | Why is this an invalid variance ? |
C_sharp : I am having a problem with the class that derives from Service , which is part of the ServiceStack library . If I setup a separate class that derives from Service and place the Get or Any methods within then everything runs fine , however , the problem is that that class itself does not have reference to any ... | ServiceStack , where to place business logic ? |
C_sharp : Just a general question , I 'm developing an ASP.NET MVC 3 web application that reads from a configuration file using the Stream Reader inside a Using statement for automatic disposal as follows : My concern is that when multiple users are running the application , a deadlock will occur when multiple instance... | Concerned about deadlocks with C # StreamReader |
C_sharp : I have a situation where I need to generate a few similar anonymous delegates . Here 's an example : The trouble I 'm having is that my code is n't very DRY . The contents of each of the event handlers is EXTREMELY similar , and could be easily parameterized into a factory method . The only thing preventing m... | C # technique for generating anonymous delegates that share same closure variable |
C_sharp : I am trying to use a string with the Prime symbol in it , but I am having some issues with the String.StartsWith method . Why is the following code throwing the exception ? I suspect that the issue is because this Prime symbol ( char ) 697 is being treated as an accent and so is changing the letter before it ... | String.StartsWith not Working when next character is the Prime Symbol ( char ) 697 |
C_sharp : I 'm getting a strange error in VS 2010 . I have a project set to use .NET Framework 4 . When I type the code : CreateSelectList basically takes an enumerable of objects , converts them to strings using ToString ( ) , and then auto-selects the string passed.The problem is , this code gets a red underline in V... | ReSharper red underline on type inference in VS 2010 |
C_sharp : I am experiencing a mid-career philosophical architectural crisis . I see the very clear lines between what is considered client code ( UI , Web Services , MVC , MVP , etc ) and the Service Layer . The lines from the Service layer back , though , are getting more blurred by the minute . And it all started wit... | Does Queryability and Lazy Loading in C # blur the lines of Data Access vs Business Logic ? |
C_sharp : How can i have a c # enum that if i chose to string it returns a different string , like in java it can be done byConsole.writeln ( sample.some ) will output : i just want my enums to return a different string when i try to call them . <code> public enum sample { some , other , things ; public string toString... | Change enum display |
C_sharp : I 'm struggling with linq ( left join - group - count ) . Please help me.Below is my code and it gives me this result.I 'm expecting this ... How can I fix it ? <code> Geography 2Economy 1Biology 1 Geography 2Economy 1Biology 0 class Department { public int DNO { get ; set ; } public string DeptName { get ; s... | LINQ left join , group by and Count generates wrong result |
C_sharp : Consider the following short code snippet.Get familiar with example # 1 first.Now consider example # 2.There is nothing terribly peculiar about example # 1 . However , things get interesting with example # 2 . It is imperative that you pay close attention to all identifiers used in the examples . As a fun exe... | Can you explain this edge case involving the C # 'using ' keyword with namespace declarations and members ? |
C_sharp : What does do ? It sorts the some value-elements to the end . But why ? Code example : <code> .OrderBy ( x = > x == somevalue ) var arr = new int [ ] { 1 , 2 , 3 } ; var arr2 = arr.OrderBy ( x = > x == 2 ) .ToArray ( ) ; // arr2 -- > 1 , 3 , 2 | Special case of OrderBy |
C_sharp : I have a dictionary where I am storing a key and 2 values in a tuple like so : So my dictionary is : key , < value1 , value2 > I want to check if a value1 is already stored in the dictionary . If my dictionary was string for the key and string for the value I could just use ContainsValue . I 'm not sure how t... | Using dictionary.ContainsValue with tuple as the value |
C_sharp : Why the Blazor UI does n't update after delete event : My Component : My Component code behind : The Delete Method : <code> < table class= '' table table-striped '' > < thead > < tr > < th > Id < /th > < th > Name < /th > < th > Example < /th > < th > < /th > < /tr > < /thead > < tbody > @ foreach ( var train... | Why the Blazor UI component does n't update after delete event ? |
C_sharp : I know it 's impossible to use return and yield return in the same method.This is the code that I would like to optimize : Important : I know this code does n't compile . It 's the code I have to optimize.There are two ways that I know of that would make this method working : convert yield return part : conve... | Changing a method that has `` return '' and `` yield return '' |
C_sharp : I thought i 've seen it all but this ... : ) I was working on a generic graph of type string , Graph is declared with a class constraint like this : Next i fill up the graph with some dynamicly generated strings : So far so good , ( Node is a internal class containing the original value and a list of referenc... | C # Generics , Comparing 2 strings fail unless explicitly specified |
C_sharp : today i have a question regarding style of WCF communication.I sometimes refuse a bit so use things programmatically ( want to have control myself ) and I do n't like huge . Sometimes communication between 2 program parts are needed , sometimes on the same machine , sometimes on network.So I tried to use WCF ... | WCF , why make it more complicated ? |
C_sharp : I 'm trying to work with some ambient transaction scopes ( thanks , entity-framework ) , which I have n't really done before , and I 'm seeing some ... odd behavior that I 'm trying to understand.I 'm trying to enlist in the current transaction scope and do some work after it completes successfully . My enlis... | Why -- HOW -- are transactions processed after disposal ? |
C_sharp : I am now working on a project wherein I will need to get the sum of a certain column in a modal table . Yes , it calculates the amount but the decimal point is not included . ( e.g I am expecting that the result will be 194,000.26 but the result shows only 193,000.00 ) so it just means it did n't add the deci... | Get total Amount of the column in AngularJs |
C_sharp : I am using a code to capture text of an application.When I start the application I cant to copy and paste any text or file in my pc.I know Why I am getting this error its because the clipboard is cleared for every second or two because I have kept the code in a loop.Its a big problem for me and my clients if ... | Unable to paste any text or file in my pc - Clipboard error |
C_sharp : Possible Duplicate : How do I detect the `` new '' modifer on a field using reflection ? Having the following declarationhow do i determine if the field has 'new ' modifier for its FieldInfo instance ? <code> public class B : A { public new string Name ; } | How to determine if a field has 'new ' modifier via reflection ? |
C_sharp : I am trying to GroupJoin some data with an IQueryable and project that data into an anonymous type . The original entity that I am GroupJoining onto has an ICollection navigation property ( ie . one : many ) . I want to eager load that property so I can access it after the group join without EF going back to ... | How to make EF eager load a collection navigation property through a GroupJoin ? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.