.net

How to add .Net3.5 dll into .Net2.0 project?

假装没事ソ 提交于 2021-02-07 06:57:04
问题 I have a dll which is based on .net 3.5 -- it uses internally for example Linq, but the exposed API is straightforward, no fancy stuff. Since C# generics are resolved at compile time I assume that for calling party all it counts is API (all public parts). However when I try to use this dll from net2.0 project I get info, that the dll cannot be referenced because the dll or one of its dependencies requires a later version of .net framework. I can install any .net version I want on target

New Table row every 4th loop

*爱你&永不变心* 提交于 2021-02-07 06:55:24
问题 How do I create a new table row on every 4th loop in my Razor View? This is creating a new row for each number before 4, and then quits creating new rows: @{ int i = 0; } @foreach (var item in ViewBag.ProgramIdList) { if((i / 4) == 0) { @:<tr> } <td> <input type="checkbox" name="@item.ProgramId" id="@item.ProgramId" /> <label for="@item.ProgramTitle">@item.ProgramTitle</label> </td> if((i / 4) == 0) { @:</tr> } i++; } 回答1: Use the modulo operator. For : if((i % 4) == 0) { @:<tr> } and if((i %

Chained GZipStream/DeflateStream and CryptoStream (AES) breaks when reading

我怕爱的太早我们不能终老 提交于 2021-02-07 06:53:40
问题 I want to compress and then encrypt my data, and for improved speed (by not having to write to byte arrays and back) decided to chain the streams used for compression and encryption together. It works perfectly when I write (compress and encrypt) the data, but when I try to read the data (decompress and decrypt), the Read operation breaks - simply calling Read once reads exactly 0 bytes, because the first Read always returns 0. Looping as in the below code almost works, except that at a

.net 4.6 framework is inplace upgrade then how is the .net framework 4.5 works in vs2015?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-07 06:50:14
问题 .net 4.6 framework is inplace upgrade then how is the .net framework 4.5 works in vs2015? I see only one folder v4.0.30319 . How is the dll stored and where ? 回答1: Update : Note that Reference Assemblies only contain metadata and NOT any code at all. Thanks @vcsjones for pointing this out below! You can find a "Reference Assemblies" folder on your system in which the exact binaries for each framework version are kept: Visual Studio then uses those depending on which version you are targeting.

How to sort list type generic if more than one property?

时光总嘲笑我的痴心妄想 提交于 2021-02-07 06:49:15
问题 I have a list-generic that has a property (class type). I need a sort method for Z parameters (TrainingSet): public override List<TrainingSet> CalculatedDistancesArray (List<TrainigSet> ts, double x, double y, int k) { for (int i =0; i < ts.Count; i++) { ts[i].Z = (Math.Sqrt(Math.Pow((ts[i].X - x), 2) + Math.Pow((ts[i].Y - y), 2))); } // I want to sort according to Z ts.Sort(); //Failed to compare two elements in the array. List<TrainingSet> sortedlist = new List<TrainingSet>(); for (int i =

Why does my icon not appear in the title bar?

∥☆過路亽.° 提交于 2021-02-07 06:44:05
问题 I have assigned an icon to my application from the Properties window in Solution Explorer in Visual Studio; the application's icon changed successfully but the title bar is still showing the default icon: I've rebuilt my application but it still displays the default icon. What am I doing wrong? 回答1: Because forms have a different icaon configuration than the application. Set the icon on the form, not ONLY on the application. 回答2: The form itself has an Icon property you need to set as well.

C# more efficient way of comparing two collections

女生的网名这么多〃 提交于 2021-02-07 06:26:10
问题 I have two collections List<Car> currentCars = GetCurrentCars(); List<Car> newCars = GetNewCars(); I don't want to use foreach loop or something because i think there should be much better way of doing this. I am looking for more efficient way to compare this collections and to get results: List of cars which are in newCars and not in currentCars List of cars which are not in newCars and in currentCars Type Car has int property Id. There was an answer, which is already deleted saying What i

dotnet publish include extra files

白昼怎懂夜的黑 提交于 2021-02-07 06:17:05
问题 I have a netcore application depends on my custom project. Because I cannot reference it directly, I have written postbuildevents that are copying my files to output: xcopy "$(SolutionDir)Ethereum.Contracts\bin\$(ConfigurationName)\*.abi" "$(TargetDir)" /Y /I xcopy "$(SolutionDir)Ethereum.Contracts\bin\$(ConfigurationName)\*.bin" "$(TargetDir)" /Y /I It works fine when I build and run project, but when run publish command it doesn't include these files. How can it be done? I tried this

dotnet publish include extra files

我只是一个虾纸丫 提交于 2021-02-07 06:16:46
问题 I have a netcore application depends on my custom project. Because I cannot reference it directly, I have written postbuildevents that are copying my files to output: xcopy "$(SolutionDir)Ethereum.Contracts\bin\$(ConfigurationName)\*.abi" "$(TargetDir)" /Y /I xcopy "$(SolutionDir)Ethereum.Contracts\bin\$(ConfigurationName)\*.bin" "$(TargetDir)" /Y /I It works fine when I build and run project, but when run publish command it doesn't include these files. How can it be done? I tried this

How can I accept arbitrary JSON objects in my REST WCF service?

六月ゝ 毕业季﹏ 提交于 2021-02-07 06:15:46
问题 I want to implement a service method like this: [OperationContract] [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat=WebMessageFormat.Json)] public void MakeShape(string shape, string color, IDictionary<string, object> moreArgs) { if (shape == "circle") { MakeCircle(color, moreArgs); } } My clients POST objects like: { "shape":"circle", "color": "blue", "radius": 42, "filled":true, "annotation": {"date":"1/1/2012", "owner":"George"} } At the call to MakeCircle, moreArgs would