text stringlengths 46 37.3k | title stringlengths 12 162 |
|---|---|
C_sharp : I have a table in my SQL Server database with a column ReviewText of datatype NVARCHAR ( MAX ) .If I insert or update rows via a SQL query with N '' prefix , for example : it works great and it will write smiley into the table.But if I insert it from code : the code will store It 's OK . ? ? without smiley in... | Can not write unicode ( emoji ) into SQL Server table via context ( Entity Framework Core ) |
C_sharp : I currently haveandThe idea is that when the mouse enters the yellow highlighted control on the left the yellow highlighted control on the right will shake . The control on the right has the x : Name=StatorMinorRadiusEdit So far so good the above works.Now I want to add another complication . I only want the ... | Putting a guard on a WPF event trigger . Is this possible ? |
C_sharp : While reading Jeffrey Richter 's CLR via C # 4th edition ( Microsoft Press ) , the author at one point states that while Object.Equals currently checks for identity equality , Microsoft should have implemented the method like this : This strikes me as very odd : every non-null object of the same type would be... | Object.Equals : everything is equal by default |
C_sharp : I have to following ProgressIndicator and in the ViewModel ascociated with this View I implement The problem is this binding is failing and I do n't know why . Using Snoop I have the following System.Windows.Data Error : 40 : BindingExpression path error : 'ProgressVisibility ' property not found on 'object '... | Binding Failure with MahAppsMetro ProgressIndicator |
C_sharp : i was wondering , because i have a method with multiple default parameters and when i call the method it i have to do it in order so my question is , is there any way to skip the first few default parameters ? Let 's say i want to input only the colour , and the font-family like this : <code> private string r... | calling a method with multiple default values |
C_sharp : I need to draw primitives with graphics object with different transformation matrix . I wonder should I dispose the matrix or graphics will do it for me : http : //msdn.microsoft.com/en-us/library/system.drawing.graphics.transform.aspx Says : Because the matrix returned and by the Transform property is a copy... | Should I dispose ( ) the Matrix returned by Graphics.Transform ? |
C_sharp : If the title did n't make sense , here 's an example : I 'd like to create an extension method like this : So I can do this : Is this possible ? Where did I go wrong ? The real-world application here is that `` Dog '' is a major base class in my application , and there are many subclasses , each of which may ... | How can I create a covariant extension method on a generic interface in C # ? |
C_sharp : So these two methods have the same signature but different constraintsBut they can not be defined in a single class because they have the same signatures . But in this particular case they 're mutually exclusive . ( Unless I 'm wrong about that ) I understand you can put additional constraints besides class a... | Mutally exclusive constraints on two methods with the same signature |
C_sharp : If I have a LINQ to SQL statement for exampleWhen I want to see what SQL is being generated by LINQ , what I do is that I comment out the ToList ( ) and put a breakpoint on the command after this LINQ statement and then I can hover it and read the SQL.My question : Is that a correct way of getting the generat... | Seeing the SQL that LINQ generates |
C_sharp : I have this sample code : It obviously return the Result from the t1 task . ( which is 1 ) But how can I get the Result from the last continued task ( it should be 3 { 1+1+1 } ) <code> Task < int > t1= new Task < int > ( ( ) = > 1 ) ; t1.ContinueWith ( r= > 1+r.Result ) .ContinueWith ( r= > 1+r.Result ) ; t1.... | Get the result for the last Task < > ( continuation ) ? |
C_sharp : Following this prototype for unit testing I 've ran into a problem when using JS interop.Just adding a component that uses IJSRuntime will cause the following exception System.InvalidOperationException : Can not provide a value for property 'JsRuntime ' on type 'Application.Components.MyComponent ' . There is... | Mocking IJSRuntime for Blazor Component unit tests |
C_sharp : When i initialize an object using the new object initializers in C # I can not use one of the properties within the class to perform a further action and I do not know why.My example code : Within the Person Class , x will equal 0 ( default ) : However person.Age does equal 29 . I am sure this is normal , but... | What am I doing wrong with C # object initializers ? |
C_sharp : I 'm struggling to implement a custom auth flow with OAuth and JWT.Basically it should go as follows : User clicks in loginUser is redirect to 3rd party OAuth login pageUser logins into the pageI get the access_token and request for User InfoI get the user info and create my own JWT Token to be sent back and ... | OAuth with custom JWT authentication |
C_sharp : I have always wondered what the best practice for using a Stream class in C # .Net is . Is it better to provide a stream that has been written to , or be provided one ? i.e : as opposed to ; I have always used the former example for sake of lifecycle control , but I have this feeling that it a poor way of `` ... | .Net streams : Returning vs Providing |
C_sharp : I want to get full url , in ASp.NET MVC 4 , for example user entered url : And when I try to get this url in Global.asax , I get only http : //localhost:5555/Thanks <code> http : //localhost:5555/ # globalName=MainLines & ItemId=5 protected void Application_BeginRequest ( object sender , EventArgs e ) { var u... | How to get full url address |
C_sharp : The screenshot says it pretty much.I have the overloads as seen in the screenshot . When using a string as second parameter the compiler should figure out that the first argument can only be a Func and not an expression.But the compiler throws an error saying ' A lamda expression with a statement body can not... | Compiler Error for Expression/Func overloads |
C_sharp : Here is my class and I do n't want this method to be overridden in child classes , how can I accomplish this behaviour ? <code> class A { public virtual void demo ( ) { } } class B : A { public override void demo ( ) { } } // when Class B be inherited in C , methods can be overridden further , // but I do n't... | Forbid overriding of a method in a derived class |
C_sharp : You can find the source code demonstrating this issue @ http : //code.google.com/p/contactsctp5/I have three model objects . Contact , ContactInfo , ContactInfoType . Where a contact has many contactinfo 's and each contactinfo is a contactinfotype . Fairly simple I guess . The problem I 'm running into is wh... | CTP5 EF Code First Question |
C_sharp : I have a function as below : I need this function to return either string or int . My return value is set as belowHow to have either one data type as return value in dynamic environment . <code> public var UpdateMapFetcher ( int stationID , int typeID ) if ( finaloutput == `` System.String '' ) { // param1 [ ... | set multiple return value for method declaration |
C_sharp : Feel like asking a stupid question but I want to know answer . I don ’ t need any code to update UI from worker thread I know how to update UI from worker/thread pool.I want to know that why we get this error “ Cross-thread operation not valid : Control `` accessed from a thread other than the thread it was c... | Why we cant update UI from worker thread ? same as other variables/object |
C_sharp : I have 2 classes declared in a css file ( StyleSheet1.css ) , .Class1 and .Class2 . How do I choose between those two classes after CLICKING A BUTTON for my table tag ? CSS File : As much as possible I want to change classes using C # if possible , but if not , javascript maybe ? I 'm very new to ASP and C # ... | Choose a class for my table after button click ? ( HTML table ) |
C_sharp : I 've run across .NET 4 's ThreadLocal < T > and was wondering if there 's a way to accumulate the .Value values from all threads . In Microsoft 's ppl C++ library they have Concurrency : :combinable : :combine_each , is there an equivalent method for .NET 's ThreadLocal ? <code> ThreadLocal < long > ticks = ... | How to combine all values from a ThreadLocal < T > ? |
C_sharp : Below is the code I 'm using but it replies with Method 'Boolean isUser ( System.String ) ' has no supported translation to SQL.Any help ? Btw I 'm using linq to SQL data sourceI found a solution to query the result of the first query as objects but is that good cause I will passing through my data twice.the ... | trying to call a method in the where of a linq statment |
C_sharp : I updated my VS Community Edition to 15.8.1 and after that I got this error when I tried to edit my sql inside strongly typed dataset . <code> Configure TableAdapter failedUnable to find connection 'my_connection ' for object 'Web.config'.The connection string could not be found in application settings , or t... | Strongly typed dataset ( .xsd ) error VS Community Edition 15.8.1 |
C_sharp : I noticed the today that my one application im developing is seriously growing in memory.So I did a Visual Studio Memory Profile and I found the following results : This was on top of the memory Usage with ~600Meg This doesnt seem correct to me and im Not sure why it is so ? Here is my send function : The app... | Memory Issue with async socket and begin Send |
C_sharp : I was handling yet another KeyDown event in a user control when I wondered if it existed a library for typing fluent code for handling event likeDoes that exist ? <code> editor.When ( Keys.F ) .IsDown ( ) .With ( Keys.Control ) .Do ( ( sender , e ) = > ShowFindWindow ( ) ) ; | Is there is a fluent approach to handling WinForm event ? |
C_sharp : I want to search the name of the students which contains the keywords , at first I pass the keywords separated by commas , but I find the search time is too long.But when I convert these keywords into an array , it is real fast.Why do linq search has a huge difference in efficiency ? Is that because of the ar... | Why do linq search has a huge difference in efficiency when I use string and array especially for large data ? |
C_sharp : I am working on a Visual Studio 2010 extension and I want to add an attribute to an MSBuild Item , as follows : So , far the only way I found is using the method IVsBuildPropertyStorage.SetItemAttribute . This works fine for simple strings , but when i try to use characters that are special to MSBuild , I get... | How do I prevent IVsBuildPropertyStorage.SetItemAttribute from escaping special characters ? |
C_sharp : The code found in the PresentationCore.dll ( .NET4 WPF ) by ILSpy : The return type of uri.GetComponents is string , why did n't the method just return the string value instead of wrapping it in a StringBuilder ( string ) .ToString ( ) ; Is this by design ? What would be the reason for doing this in a general... | Why does the WPF Presentation library wrap strings in StringBuilder.ToString ( ) ? |
C_sharp : In the following code , I create a DispatcherTimer in the class 's constructor . No one keeps reference on it.In my understanding , the timer should be reclaimed by the garbage collector some time after leaving the constructor 's scope . But that does n't happen ! Even after forcing a garbage collection with ... | Garbage collection of C # object declared in constructor |
C_sharp : Assuming I have an attached property defined like that : I can write the documentation for the property identifier ( MyPropertyProperty ) and for the accessors ( GetMyProperty and SetMyProperty ) , but I have no idea where to put the documentation for MyClass.MyProperty attached property , since it is not an ... | Where to put the XML documentation comments for an attached property ? |
C_sharp : My Goal : I have a system where I would like others to be able to add a C # script that contains a specific method that I can lookup and execute from within another class at runtime.My Approach : I created an interface with a method so I can loop through any class that implements the interface using reflectio... | Dynamically invoke a method given a Type variable |
C_sharp : I am trying to develop a mechanism using which I can execute any method with 1 retry attempt . The retry will be triggered if an exception is encountered in the 1st run.The basic Idea is , I will have a generic class for the retry logic , and I want to pass any method in it via delegates . And that method wil... | Generic method to execute any method with 1 time retry using Delegates |
C_sharp : I Have a DbContext where i need a CompanyId to make a global query , like multi tenant.The CompanyId is added to a token claim , how i 'm can get the claim value and inject on the DbContext ? <code> public void SetGlobalQuery < T > ( ModelBuilder builder ) where T : BaseEntity { builder.Entity < T > ( ) .HasQ... | How to get a token claim value and inject on a dbcontext service |
C_sharp : I do have an MVC website , which is running locally just fine.When I 'm debugging the application , off course , it 's running under the HTTP protocol then everything works fine.I do have a controller : Note : I 've removed the code from this method here because it 's irrelivant.This method is called through ... | StackOverflowException when posting JSon data to server ( HTTP / HTTPS ) |
C_sharp : I am currently writing a helper library that connects to shop floor PLCs via Software Toolbox 's TopServer . The TopServer library has separate versions for x86 and x64 architectures and I want to load the appropriate version at runtime using late binding based on the CPU architecture of the calling code . Th... | Late Binding to dll based on CPU architecture |
C_sharp : I have a system which uses AOP with ContextBoundObject.This is used to intercept a method call and perform certain operations before and after the function . It all works fine until I make the 'function to be intercepted ' async.I understand that the C # compiler rewrites async methods into a state machine , ... | ContextBoundObject with Async/Await |
C_sharp : I just download the Iron JS and after doing some 2/3 simple programs using the Execute method , I am looking into the ExecuteFile method.I have a Test.js file whose content is as underI want to invoke the same from C # using Iron JS . How can I do so ? My code so farBut loadfile variable is null ( path is cor... | How to invoke a function written in a javascript file from C # using IronJS |
C_sharp : While giving answer to an SO question , I was told that my solution will introduce a closure over variable so it will have slightly worse performance . So my question is : How will there be a closure ? How will it affect performance ? Here is the questionHere is my solution . I introduced the variable yr to s... | `` Closure over variable gives slightly worse performance '' . How ? |
C_sharp : I am working on a project in which I am binding Cart : As shown in image I am populating my cart . Using User Control . And in User control I have populated that using One simple aspx form that is minicart . So now as you can see there is one button Checkout in That page . Which is populated through User Cont... | Calling Page Click event via User Control |
C_sharp : I 'm using protobuf-net for serializing a number of types , some of which are inherited from a base type . I know that the Protocol Buffers spec does not support inheritance , and that the support in protobuf-net is basically a workaround because of that.Rather than using the protobuf-net attributes I am conf... | How to choose a field number when using protobuf-net inheritance ? |
C_sharp : IntroductionWhile testing performance differences with certain LinQ functions today , I noticed , that LastOrDefault ( predicate ) was almost always faster than FirstOrDefault ( predicate ) , which got me a little interested , so i wrote some test cases , to test both functions against each other.I created a ... | Why is LastOrDefault ( predicate ) in LINQ faster than FirstOrDefault ( predicate ) |
C_sharp : A colleague pointed me to a strange case in C # ( not so sure if this actually strange though ) . Suppose you have a class Employee . If you want to create a Generic List < > of type Employee , you can simply do : I understand that I need to pass the Employee type to the Generic list so that it knows the requ... | Why this is not possible in C # Generics ? |
C_sharp : Why is it that when run I website using Azure SDK 1.3 it opens two browser windows ( or tabs ) despite the fact that I have only defined one end point : What do I have to do to get just one browser window appearing when I run ( using F5 ) my Azure application from Visual Studio ? <code> < Sites > < Site name=... | Azure SDK 1.3 opens two browser windows ( or tabs ) |
C_sharp : In a WinForms application , a Panel is used as a placeholder to display a single User Control as a navigation strategy : whenever the user wishes to navigate to a given area , the respective User Control is added to the Panel . Simplified : As a result of a requirement that is out of my control , the Form mus... | Re-apply layout of a dynamically added UserControl after calling ApplyResources |
C_sharp : I trying to convert from WPF combobox selected value to enumurator it return not valid cast in the runtime otherwise the string and the enum name is matched my code is <code> Siren.PfundMemberWebServices.Emirates EM = ( Siren.PfundMemberWebServices.Emirates ) cmbemirate.SelectedValue | Convert from String to Enum return not valid cast in WPF |
C_sharp : I 'm wondering if there is any shortcut in visual studio to generate automatic documentation for a method or class.For example when I write a method : I want generate the following structure : <code> public void MyFunction ( int d ) { } /// < summary > /// /// < /summary > /// < param name= '' d '' > < /param... | how to simplify code documentation process - visual studio C # |
C_sharp : I 'm trying to write a small little scripting engine for a bullet hell game and I would like to do it in F # . I wrote some C # code to conceptualize it , but I 'm having trouble porting it to F # . The C # code is posted below , and I would like some help porting it to F # . I have a feeling the matching F #... | F # : Need help converting C # to F # |
C_sharp : Why is x dynamic , compiler not smart enough or I miss something important ? <code> public string Foo ( object obj ) { return null ; } public string Foo ( string str ) { return null ; } var x = Foo ( ( dynamic ) `` abc '' ) ; | Why dynamic call return dynamic result ? |
C_sharp : Lets say I have a library , version 1.0.0 , with the following contents : and I reference this library in a console application with the following contents : Running the program will output the following : If I build a new version of the library , version 2.0.0 , looking like this : and copy this version to t... | Method binding to base method in external library ca n't handle new virtual methods `` between '' |
C_sharp : For a network protocol implementation I want to make use of the new Memory and Span classes to achieve zero-copy of the buffer while accessing the data through a struct.I have the following contrived example : The result is that buffer is filled with 7 , 6 , 5 , 4 , 3 , 2 , 1 , which is as desired , but I can... | Proper way to get a mutable struct for Memory < byte > / Span < byte > ? |
C_sharp : This is a spin-off question based on Eric Lippert 's answer on this question.I would like to know why the C # language is designed not being able to detect the correct interface member in the following specific case . I am not looking on feedback whether designing a class this way is considered best practice ... | Interface conflict resolution in C # |
C_sharp : I have a `` Status '' class in C # , used like this : You get the idea.All callers of MyFunction should check the returned Status : Lazy callers however can ignore the Status.or Is it possible to make this impossible ? e.g . an throw exceptionIn general : is it possible to write a C # class on which you have ... | Enforcing required function call |
C_sharp : The IndexOf function called on a string returns -1 , while there definitely is a match.Do you have any idea , why it is that it finds `` NY '' but not `` N '' by itself ? If I search for every other letter in the string , it is able to find it , but not the `` N '' .The same issue appears as well with lower c... | Why ca n't IndexOf find the character N in combination with Y in hungarian culture ? |
C_sharp : I work on a fairly large product . It 's been in development since .Net 1.0 was still a work-in-progress and so it has a lot of bad quality code and was not written with unit tests in mind . Now we 're trying to improve the quality and implement tests for each feature and bug fix . One of the biggest problems... | Interface inheritance to breakup god objects ? |
C_sharp : I read alot about async/await , but I still have some lack in understanding the following situation.My question is , should I implement my `` wrapper '' methods as in DoSomething ( ) or like in DoSomethingAsync ( ) .So what 's better ( and why ) : Do I use await in wrapper methods or return the Task directly ... | Struggling with async/await C # |
C_sharp : I am a bit new to c # so please overlook if you find it trivial . I saw the following `` weird '' code.Can anybody shed a bit of light on it.Specially the _action -= c ; part . <code> public event Action _action ; if ( _action ! = null ) { foreach ( Action c in _action.GetInvocationList ( ) ) { _action -= c ;... | Correct usage of Action and Events |
C_sharp : I have the following dependencyProject A ( owned by me ) uses project_b.dllNewtonsoft.Json.dll ( version 8 ) Project B usesproject_c.dllNewtonsoft.Json.dll ( version 9 ) Project C usesNewtonsoft.Json.dll ( version 4.5 ) Project A calls a method of Project B which will call a method of Project C , then return ... | C # Assembly Binding Redirects - Newtonsoft.Json |
C_sharp : In C # 6.0 you can write this : They have the same result of : But you ca n't write this : It generates the following error : Invalid expression term 'object'.But you can still write this : Why nameof ( object ) does not compile ? <code> var instance = default ( object ) ; var type = typeof ( object ) ; var i... | Why is nameof ( object ) not allowed ? |
C_sharp : I 'm developing a C # application that supports Windows Aero in the main form.Some applications that do not support Visual Styles , for example GoToMeeting , disable visual styles and my form is wrongly drawn while GoToMeeting is running ( the Aero client area is drawn black ) .How could I subscribe to a OS e... | How do I subscribe to an OS-level event raised when DWM composition/Aero Glass is disabled ? |
C_sharp : Take the following simple code . The DoMyCode method has two attributes applied to it , with a space between the entries.This was made in VS 2015 targeting .Net 4.6.If you run this code in Visual Studio 2015 ( update 3 ) it will compile and run with no errors or warnings.However , running the exact same code ... | Why does VS 2015 allow attributes separated by spaces while VS 2017 does not ? |
C_sharp : Excuse me if I am asking silly question , but can anybody explain the difference between following two calls ( ToArray ) . In the intellisense it does not show them as overloaded methods & of course the output of both the calls are same . <code> List < int > i = new List < int > { 1 , 2 , 5 , 64 } ; int [ ] i... | Difference between ToArray ( ) & ToArray < int > ( ) ; |
C_sharp : I have a method like : Here I am trying to get text from a string until & character is found . My senior modified this method to So instead of storing the index , it will calculate it twice , and his reasoning was that since that method would be called in multiple threads , there could be invalid value stored... | Reentrant code and local variables |
C_sharp : I have an array Vector2f structs that each contain two floats , and I want to pass it to a function that takes an array of floats . These structs represent 2d coordinates , and I want the end result to be [ x0 , y0 , x1 , y1 , ... xn , yn ] . Some code to demonstrate : This is easy by copying the contents int... | Use an array of Vector2f structs as an array of floats in-place |
C_sharp : I started to use Ninject , on this relatively small project and i have run into a problem : i have this classthat depends on that in turn depends on the DataRepository has a ctor that looks like : Now , i need to be able to use a single instance of BizEntityModel across more than one IDataRepository instance ... | How to keep IoC container in one place , while inner classes need to create dependencies after beeing constructed |
C_sharp : I am trying to build a query like thisBut when I run this I get Is Math.Abs not supported or do I have to do it differently ? Here is the sql statement ( a couple more fields then what was in my example ) big this is that it is translating it toso has an extra `` as '' in it.Pick class <code> var d = dbContex... | Math Absolute In Ef Core ? |
C_sharp : I am trying to print a WPF visual ( a Canvas to be exact ) containing multiple images . The image sources are loaded from base64 strings that are converted to BitmapSources . When the canvas is shown in a Window the 2 images are displayed correctly , however when its printed using PrintVisual method of PrintD... | Printing a WPF Visual Containing Images |
C_sharp : First , this is not a duplicate of IEnumerable < T > as return type for WCF methods , I think I understand that the WCF architecture only allows concrete types to be transferred that can be stuffed into a message.Second , our setup however is not a general service but connecting up a bundle of proprietary app... | Getting IEnumerable < T > semantics with a NetTcpBinding WCF service ? |
C_sharp : So , I have a datagrid that has different colour cells depending on the cell 's value.I also have a tooltip that displays some further information . This all works fine.I , however , would like to alter the tooltip to show further information and also to be the same colour as the cell . So , I thought it woul... | Control template : how to create bindings |
C_sharp : I being following the Unity Interception link , to implement Unity in my project.By , following a link I have made a class as shown below : Till now I have done nothing special , just followed the example as explained in the upper link . But , when I have to implement the Unity Interception class , I came up ... | Unity Interception Concept Clarity |
C_sharp : If you are parsing , lets just say HTML , once you read the element name , will it be beneficial to intern it ? The logic here is that this parser will parse the same strings ( element names ) over and over again ? And several documents will be parsed.Theory : This question was motivated by the question strin... | Will Interning strings help performance in a parser ? |
C_sharp : If anyone cares , I 'm using WPF ... .Beginning of story : I got a series of gray-scale images ( slices of a model ) . The user inputs a `` range '' of gray-scale values to build a 3D model upon . Thus I created a 3D bool array to make it easier to build the 3D model . This array represents a box of pixels , ... | How could I polygonise a bool [ , , ] |
C_sharp : How do you concatenate huge lists without doubling memory ? Consider the following snippet : The output is : I would like to keep memory usage to 2014 MB after concatenation , without modifying a and b . <code> Console.WriteLine ( $ '' Initial memory size : { Process.GetCurrentProcess ( ) .WorkingSet64 /1024 ... | How to concatenate lists without using extra memory ? |
C_sharp : I am having a huge problem in all browsers.I have a site where clients can download a csv file that contains detail they need.The problem I am having is that the csv file either downloads with no extension or as a htm file.In the code I am specifying the file name with .csv , the file on the server is also a ... | CSV downloads as HTM |
C_sharp : Why is it not possible to have implicitly-typed variables at a class level within C # for when these variables are immediately assigned ? ie : Is it just something that has n't been implemented or is there a conceptual/technical reason for why it has n't been done ? <code> public class TheClass { private var ... | var in C # - Why ca n't it be used as a member variable ? |
C_sharp : I 'm trying to save any logs I received from the application into a log table in my db and so far , nothing gets saved . I 'm using Log4net and AdoNetAppender for saving the logs into my table inside SQL Server . This code sits inside a Web API project on the server side of my app . I set up the logs as follo... | Logs do not get saved into Logs table |
C_sharp : I want to increase values on timer tick event but it is not increasing do n't know what I am forgetting it is showing only 1 . <code> < asp : Timer ID= '' Timer1 '' runat= '' server '' OnTick= '' Timer1_Tick '' Interval= '' 1000 '' > < /asp : Timer > private int i = 0 ; protected void Timer1_Tick ( object sen... | Timer Tick not increasing values on time interval |
C_sharp : I have always included the at sign in the parameter name when using AddWithValue , but I just noticed some code written by someone else that does n't use it . Is one way more correct than the other ? or <code> cmd.Parameters.AddWithValue ( `` ixCustomer '' , ixCustomer ) ; cmd.Parameters.AddWithValue ( `` @ i... | should I include the @ when using SqlCommand.Parameters.AddWithValue ? |
C_sharp : I 'm trying to record audio and immediately send it to IBM Watson Speech-To-Text for transcription . I 've tested Watson with a WAV file loaded from disk , and that worked . On the other end , I 've also tested with recording from microphone and storing it to disk , works good too . But when I try to record t... | Recording WAV to IBM Watson Speech-To-Text |
C_sharp : I 'm using Entity Framework 6.1.1 and I have a Users table and a User_Documents table ( 1 : many ) . I already had a navigation property from User_Documents to User were things were working fine.I added a navigation property from Users to User_Documentsand now I 'm getting an error when I try to run the appli... | Entity Framework getting confused about navigation property |
C_sharp : In other words , is functionally identical to Stated another way , isfunctionally identical toAccording to Task.Wait and Inlining , if the Task being Wait ’ d on has already started execution , Wait has to block . However , if it hasn ’ t started executing , Wait may be able to pull the target task out of the... | Is calling Task.Wait ( ) immediately after an asynchronous operation equivalent to running the same operation synchronously ? |
C_sharp : I 've been playing with a c # app that hosts IronPython , IronRuby , and ( hopefully ) PowerShell . Since IronPython and IronRuby were completely built on the DLR , the API for using them is pretty much identical . andboth create instances of a Microsoft.Scripting.Hosting.ScriptEngine . Is there any hope of c... | How can I host PowerShell 3.0 in a c # app using a similar API to other DLR languages |
C_sharp : While reflecting with ILSpy i found this line of code in the Queue < T > .Enqueue ( T item ) -method : I 'm just wondering why somebody would do this ? I think it 's some kind of a integer overflow check , but why multiply first with 200L and then divide by 100L ? Might this have been a issue with earlier com... | Strange Queue < T > .Enqueue ( T item ) code |
C_sharp : I want to start the new On-Screen-Keyboard ( OSK ) using code . You can find this one in the taskbar : ( if not there you find it by right clicking the taskbar ) .I have already tried the regular : But I want to start the other one ( not in window mode ) . Here you see which OSK I want and which one not : How... | How to open the tablet-mode on-screen-keyboard in C # ? |
C_sharp : For some time I have had a custom Visual Studio code snippet to assist in injecting a copyright header in my C # source files . It looks something like this : The important thing to note for this question is the two trailing endlines at the end of the CDATA block . In editions of Visual Studio prior to 2015 ,... | Visual Studio 2015 Code Snippet with significant trailing whitespace |
C_sharp : Can I reduce this razor code ? I was trying this but it does n't work : <code> < li > @ { if ( @ Model.PublicationDate.HasValue ) { @ Model.PublicationDate.Value.ToString ( `` D '' , new System.Globalization.CultureInfo ( `` fr-FR '' ) ) } else { @ : '' pas disponible '' } } < /li > @ { ( @ Model.PublicationD... | Can I reduce razor code to just few lines ? |
C_sharp : So I 'm writing a `` dynamic '' Linq query . I 've created an `` options '' class that holds all of the dynamic options that can be a part of the query . Some of these option properties are List objects , which hold IDs of entities that I want to return that are part of many-to-many relationships in SQL Serve... | LINQ & Many to Many Relationships |
C_sharp : We are using Machine.Specification as our test framework on my current project . This works well for most of what we are testing . However , we have a number of view models where we have 'formatted ' properties that take some raw data , apply some logic , and return a formatted version of that data . Since th... | Does MSpec support `` row tests '' or data-driven tests , like NUnit TestCase ? |
C_sharp : Say I have the followingIs there any way to specify that my Func < T > parameters must obey some contracts ? <code> public T Example ( Func < T > f ) { Contract.Requires ( f ! = null ) ; Contract.Requires ( f ( ) ! = null ) ; // no surprise , this is an error ... } | Specify code contract on Func < T > parameters ? |
C_sharp : In a C # controller , I have a function defined with an optional parameter which is set to default to null ( see code example below ) . The first time the page loads , the function is called and the filter is passed in as an initialized object , despite the default value being null . I would like it to be nul... | Optional Parameters in C # - Defaulting a user-defined Class to null |
C_sharp : Given a CancellationToken , I want to call a 'cancel ' method on an object that represents an asynchronous operation when the CancellationToken is cancelled . Is this possible ? Background : I 'm interfacing with an API that represents an async op the following way ( more or less ) : I can wrap this in a meth... | How to run code when a CancellationToken is cancelled ? |
C_sharp : In C # it 's conventional to write in a fairly objective manner , like so : I could just write the above like this : However , how does the stackframe work when you have a bunch of function calls in a sequence like this ? The example is fairly straightforward but imagine if I 've got 50+ function calls chaine... | C # : How do sequential function calls work ? ( efficiency-wise ) |
C_sharp : An application I 'm working on processes Work Items . Depending on the state of a work item there are a number of actions available . `` Complete '' `` Cancel '' `` Reassign '' etc ... To provide the functionality for the actions I currently have an interface that looks something like this ... Then based on o... | Recommend a design pattern |
C_sharp : Following is a complete console program that reproduces a strange error I have been experiencing . The program reads a file that contains urls of remote files , one per line . It fires up 50 threads to download them all.On my local computer it works fine . On the server , after downloading a few hundred image... | Multithread error not caught by catch |
C_sharp : Im trying to see some queries that my application using EntityFramework does.In my method wich is not async i can see the queries normally : But if its like : Is it possible to get the queries of a async method in IntelliTrace Events ? Thanks . <code> public List < Tool > GetTools ( ) { return EntityContext.T... | How to trace async database operations in Intellitrace Events ? |
C_sharp : Back when I was learning about foreach , I read somewhere that this : is basically equivalent to this : Why does this code even compile if neither IEnumerator nor IEnumerator < T > implement IDisposable ? C # language specification only seems to mention the using statement in the context of IDisposable.What d... | Why does the using statement work on IEnumerator and what does it do ? |
C_sharp : We have a REST API method similar to : This is a fairly costly method with some complicated DB calls , and we have a common situation where hundreds of users with the same AccountId will make the call almost simultaneously ( they are all being notified with a broadcast ) .In the method , we cache the result s... | Pause simultaneous REST calls until first one completes |
C_sharp : Upon successful login I want to save a cookie which contains username.The cookie saves correctly and loads username correctly but loses session ! The code to retreive username is : The code to save username is : Any help will be greatly appreciated , Thank you <code> if ( Request.Cookies [ `` userName '' ] ! ... | Session lost when saving cookie |
C_sharp : Reading a Previous SO Question I was confused to find Eric Lippert saying that an interface can not be defined in C # for all Monads , using an implementation as below : My problem is all the problems listed in the question seem to have easy solutions : no `` higher kinded types '' = > use parent interfacesno... | Here is the C # Monad , where is the problem ? |
C_sharp : Note : For Assert , using XunitAnonymous objects use value equality : Anonymous arrays with anonymous objects use value equality : Anonymous objects with nested arrays seem to use reference equality ( this fails ) : But this works ( presumably because there 's now reference equality ) : And this works ( so it... | In C # , how do you get recursive value equality for nested anonymous arrays and objects ? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.