Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

Recent questions tagged C#

0 votes
605 views
1 answer
    I have the following code: public int Method(MyEnum myEnum) { switch (myEnum) { case MyEnum.Value1: return 1; ... Can an enum somehow be null? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
382 views
1 answer
    I have a method like: int f() { try { int i = process(); return i; } catch(Exception ex) { ThrowSpecificFault ... ). Any cleaner way to do this? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
540 views
1 answer
    private void DialogFont_Load(object sender, EventArgs e) { LoadInstalledFonts(); SetupInitialDialogSelections(); lblPreview. ... Any ideas? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
303 views
1 answer
    Can anyone explain what is the complexity of the following Dictionary methods? ContainsKey(key) Add(key,value); ... dictionary. Is this correct? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
306 views
1 answer
    As fields are implicitly private, why there is often explicit declaraion used in the books, articles etc.? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
435 views
1 answer
    I've started using Visual Studio 2015 today and really like the Light Bulb or Quick Action setting. I want to ... this rule or remove it? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
332 views
1 answer
    In ASP.NET Core 2.x I used standard routes registation Configure method of Startup class to register ... method for endpoints registration. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
218 views
1 answer
    Is it possible to set property on each element from List using LINQ. for example: var users = from u in ... possible to make it cleaner ? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
327 views
1 answer
    When you do stuff like: for (int i = 0; i < collection.Count; ++i ) is collection.Count called on ... dynamically gets the count on call? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
614 views
1 answer
    Are there cases when you would want a public readonly field v.s. a get-only auto-implemented property? public ... I might be missing something. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
146 views
1 answer
    I've many objects, each of which I have information in string about its type. like: string stringObjectType ... by: typeof (stringObjectType) See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
397 views
1 answer
    I have a List<bool> with lots of values. What is the most efficient way to check if every single item in the list equals false? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
521 views
1 answer
    Is the following pseudocode thread-safe ? IList<T> dataList = SomeNhibernateRepository.GetData(); Parallel.For(..i ... that whatsoever. Thanks. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
872 views
1 answer
    I have a (C#) function similar to the following. private static bool SpecialCase = false; public ... InternalMethod is effectively unreachable. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
582 views
1 answer
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body xmlns:xsi="http://www.w3.org/2001/ ... . What am I doing wrong here? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
317 views
1 answer
    I need to add numerous variables of type nullable int. I used the null coalescing operator to get it down to one ... Console.ReadLine(); } } } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
294 views
1 answer
    I've been using File.ReadAllText() to open a CSV file, but every time I forget to close the file in ... around with buffers and char arrays? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
357 views
1 answer
    When using a memory stream in a using statement do I need to call close? For instance is ms.Close() needed here? ... // stuff ms.Close(); } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
258 views
1 answer
    We're using Database first approach with EntityFramework. We've several customers, and when we deploy new ... to customers DB automatically? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
475 views
1 answer
    Is it possible to overload the null-coalescing operator for a class in C#? Say for example I want to return a ... if the MyClass.MyValue is set? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
346 views
1 answer
    I have the following code : PropertyInfo[] originalProperties = myType.GetProperties(); I want to exclude from ... is not an option. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
426 views
1 answer
    I have a list of tasks, which i'd like to wait for. I'm waiting like await TaskEx.WhenAll(MyViewModel. ... , which would be finished instantly? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
428 views
1 answer
    How can I do this in XAML: PSEUDO-CODE: <TextBox Text="{Binding Password}" Type="Password"/> so that the ... doesn't have a Text property. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
203 views
1 answer
    I'd like to enumerate a string and instead of it returning chars I'd like to have the iterative variable be of ... // this will not compile } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
237 views
1 answer
    Is there a modern .NET equivalent to the TextFieldParser class in VB6? Performance is a lot lower than a simple String.Split() See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
414 views
1 answer
    Currently I'm recording an audio signal with following specs: Channels: 1 SamplesPerSecond: 8000 BitsPerSample: 16 ... : 22050 BitsPerSample: 16 See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
576 views
1 answer
    I am using this code: DirectoryInfo dir = new DirectoryInfo("D:"); foreach (FileInfo file in dir.GetFiles("*.* ... . How might I solve this? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
458 views
1 answer
    Can anyone convert this simple LINQ-to-SQL to an Expression Tree: List<Region> lst = (from r in dc.Regions where ... "ern") select r).ToList(); See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
Ask a question:
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...