search
HomeBackend DevelopmentC#.Net TutorialA very powerful control--PropertyGrid

A very powerful control--PropertyGrid

Jun 24, 2017 am 09:49 AM
controlcustomize

PropertyGrid is a very powerful control. One advantage of using this control as a property setting panel is that you only need to focus on the code without paying attention to the presentation of the UI. The PropertyGrid will select the appropriate control to display based on the variable type by default. But this also brings about a problem, that is, the use of the control is not particularly flexible, mainly because you cannot choose the control according to your needs. For example, when you need to use the Slider control to set an int variable, the PropertyGrid defaults to The template selector is not supported. I found a lot of information on the Internet that basically introduced the implementation of WinForm, mainly using the IWindowFromService interface. I did not find a suitable demo suitable for WPF. Later, after referring to the official demo of DEVExpress, I made a demo based on WPF and DEV 16.2. PropertyGrid Demo basically implements the above functions.

In order to achieve this, you need to customize a DataTemplateSeletor class, which is also the core code of this article.

1. Create a CustomPropertyGrid custom control:

 1 <usercontrol>12     <usercontrol.resources>13         <resourcedictionary>14             <resourcedictionary.mergeddictionaries>15                 <!--  资源字典  -->16                 <resourcedictionary></resourcedictionary>17             </resourcedictionary.mergeddictionaries>18         </resourcedictionary>19     </usercontrol.resources>20     <grid>21         <!--  PropertyDefinitionStyle:定义属性描述的风格模板  -->22         <!--  PropertyDefinitionTemplateSelector:定义一个模板选择器,对应一个继承自DataTemplateSelector的类  -->23         <!--  PropertyDefinitionsSource:定义一个获取数据属性集合的类,对应一个自定义类(本Demo中对应DataEditorsViewModel)  -->24         <propertygridcontrol25></propertygridcontrol25>34     </grid>35 </usercontrol>
CustomPropertyGrid

This control uses The resource dictionary is as follows:

 1 <resourcedictionary>11 12     <dynamicallyassigndataeditorstemplateselector></dynamicallyassigndataeditorstemplateselector>13     <dataeditorsviewmodel></dataeditorsviewmodel>14 15     <datatemplate>16         <richtextbox17></richtextbox17>25     </datatemplate>26     <datatemplate>27         <richtextbox28></richtextbox28>36     </datatemplate>37 38     <!--  设置控件的全局样式和数据绑定  -->39     <style>40         <Setter Property="Path" Value="{Binding Name}" />41         <!--<Setter Property="Header" Value="{Binding Converter={StaticResource PropertyDescriptorToDisplayNameConverter}}"/>-->42         <Setter Property="Description" Value="{Binding}" />43         <Setter Property="DescriptionTemplate" Value="{StaticResource descriptionTemplate}" />44     </style>45     <style>46         <Setter Property="ShowSelectedRowHeader" Value="False" />47         <Setter Property="MinHeight" Value="70" />48     </style>49 50     <style>51         <Setter Property="Margin" Value="2" />52     </style>53     <style>54         <Setter Property="IsTextEditable" Value="False" />55         <Setter Property="ApplyItemTemplateToSelectedItem" Value="True" />56         <Setter Property="Margin" Value="2" />57     </style>58 59     <!--  测试直接从DataTemplate获取控件  -->60     <datatemplate>61         <!--<dxprg:PropertyDefinition>62             <dxprg:PropertyDefinition.CellTemplate>-->63         <!--<DataTemplate>-->64         <stackpanel>65             <slider66></slider66>69             <textblock></textblock>70         </stackpanel>71         <!--</DataTemplate>-->72         <!--</dxprg:PropertyDefinition.CellTemplate>73         </dxprg:PropertyDefinition>-->74     </datatemplate>75 76     <datatemplate>77         <textblock78></textblock78>82     </datatemplate>83 </resourcedictionary>
ResourceDictionary

2. Write the corresponding template selection class DynamicallyAssignDataEditorsTemplateSelector:

  1 using DevExpress.Xpf.Editors;  2 using DevExpress.Xpf.PropertyGrid;  3 using System.ComponentModel;  4 using System.Reflection;  5 using System.Windows;  6 using System.Windows.Controls;  7 using System.Windows.Data;  8   9 namespace PropertyGridDemo.PropertyGridControl 10 { 11     public class DynamicallyAssignDataEditorsTemplateSelector : DataTemplateSelector 12     { 13         private PropertyDescriptor _property = null; 14         private RootPropertyDefinition _element = null; 15         private PropertyDataContext _propertyDataContext => App.PropertyGridDataContext; 16  17         /// <summary> 18         /// 当重写在派生类中,返回根据自定义逻辑的 <see></see> 。 19         /// </summary> 20         /// <param>数据对象可以选择模板。 21         /// <param>数据对象。 22         /// <returns> 23         /// 返回 <see></see> 或 null。默认值为 null。 24         /// </returns> 25         public override DataTemplate SelectTemplate(object item, DependencyObject container) 26         { 27             _element = (RootPropertyDefinition)container; 28             DataTemplate resource = TryCreateResource(item); 29             return resource ?? base.SelectTemplate(item, container); 30         } 31  32         /// <summary> 33         /// Tries the create resource. 34         /// </summary> 35         /// <param>The item. 36         /// <returns></returns> 37         private DataTemplate TryCreateResource(object item) 38         { 39             if (!(item is PropertyDescriptor)) return null; 40             PropertyDescriptor pd = (PropertyDescriptor)item; 41             _property = pd; 42             var customUIAttribute = (CustomUIAttribute)pd.Attributes[typeof(CustomUIAttribute)]; 43             if (customUIAttribute == null) return null; 44             var customUIType = customUIAttribute.CustomUI; 45             return CreatePropertyDefinitionTemplate(customUIAttribute); 46         } 47  48         /// <summary> 49         /// Gets the data context. 50         /// </summary> 51         /// <param>Name of the data context property. 52         /// <returns></returns> 53         private object GetDataContext(string dataContextPropertyName) 54         { 55             PropertyInfo property = _propertyDataContext?.GetType().GetProperty(dataContextPropertyName); 56             if (property == null) return null; 57             return property.GetValue(_propertyDataContext, null); 58         } 59  60         /// <summary> 61         /// Creates the slider data template. 62         /// </summary> 63         /// <param>The custom UI attribute. 64         /// <returns></returns> 65         private DataTemplate CreateSliderDataTemplate(CustomUIAttribute customUIAttribute) 66         { 67             DataTemplate ct = new DataTemplate(); 68             ct.VisualTree = new FrameworkElementFactory(typeof(StackPanel)); 69             ct.VisualTree.SetValue(StackPanel.DataContextProperty, GetDataContext(customUIAttribute.DataContextPropertyName)); 70  71             FrameworkElementFactory sliderFactory = new FrameworkElementFactory(typeof(Slider)); 72             sliderFactory.SetBinding(Slider.MaximumProperty, new Binding(nameof(SliderUIDataContext.Max))); 73             sliderFactory.SetBinding(Slider.MinimumProperty, new Binding(nameof(SliderUIDataContext.Min))); 74             sliderFactory.SetBinding(Slider.SmallChangeProperty, new Binding(nameof(SliderUIDataContext.SmallChange))); 75             sliderFactory.SetBinding(Slider.LargeChangeProperty, new Binding(nameof(SliderUIDataContext.LargeChange))); 76             sliderFactory.SetBinding(Slider.ValueProperty, new Binding(nameof(SliderUIDataContext.Value))); 77             ct.VisualTree.AppendChild(sliderFactory); 78  79             FrameworkElementFactory textFacotry = new FrameworkElementFactory(typeof(TextBlock), "TextBlock"); 80             textFacotry.SetValue(TextBlock.TextProperty, new Binding(nameof(SliderUIDataContext.Value))); 81             //textBoxFactory.AddHandler(TextBox.IsVisibleChanged, new DependencyPropertyChangedEventHandler(SearchBoxVisibleChanged)); 82             ct.VisualTree.AppendChild(textFacotry); 83             ct.Seal(); 84             return ct; 85         } 86  87         /// <summary> 88         /// Creates the ComboBox edit template. 89         /// </summary> 90         /// <param>The custom UI attribute. 91         /// <returns></returns> 92         private DataTemplate CreateComboBoxEditTemplate(CustomUIAttribute customUIAttribute) 93         { 94             DataTemplate template = new DataTemplate(); 95             template.VisualTree = new FrameworkElementFactory(typeof(DockPanel)); 96             template.VisualTree.SetValue(DockPanel.DataContextProperty, GetDataContext(customUIAttribute.DataContextPropertyName)); 97  98             FrameworkElementFactory textFactory = new FrameworkElementFactory(typeof(TextBlock)) ; 99             textFactory.SetValue(TextBlock.TextProperty, new Binding(nameof(ComboBoxEditDataContext.Name)));100             template.VisualTree.AppendChild(textFactory);101 102             FrameworkElementFactory comboBoxEditFactory = new FrameworkElementFactory(typeof(ComboBoxEdit));103             comboBoxEditFactory.SetBinding(ComboBoxEdit.ItemsSourceProperty, new Binding(nameof(ComboBoxEditDataContext.ItemSource)));104             comboBoxEditFactory.SetBinding(ComboBoxEdit.EditValueProperty, new Binding(nameof(ComboBoxEditDataContext.EditValue)));105             comboBoxEditFactory.SetBinding(ComboBoxEdit.SelectedIndexProperty, new Binding(nameof(ComboBoxEditDataContext.SelectedIndex)));106             comboBoxEditFactory.SetValue(ComboBoxEdit.ItemTemplateProperty, (DataTemplate)_element.TryFindResource("ComboBoxEditItemTemplate"));107             template.VisualTree.AppendChild(comboBoxEditFactory);108             template.Seal();109             return template;110         }111 112         /// <summary>113         /// Creates the property definition template.114         /// </summary>115         /// <param>The custom UI attribute.116         /// <returns></returns>117         private DataTemplate CreatePropertyDefinitionTemplate(CustomUIAttribute customUIAttribute)118         {119             DataTemplate dataTemplate = new DataTemplate();120             DataTemplate cellTemplate = null;//单元格模板121             FrameworkElementFactory factory = new FrameworkElementFactory(typeof(PropertyDefinition));122             dataTemplate.VisualTree = factory;123             switch (customUIAttribute.CustomUI)124             {125                 case CustomUITypes.Slider:126                     cellTemplate = CreateSliderDataTemplate(customUIAttribute); break;127                     //cellTemplate = (DataTemplate)_element.TryFindResource("SliderTemplate");break;128                 case CustomUITypes.ComboBoxEit:129                     cellTemplate = CreateComboBoxEditTemplate(customUIAttribute);break;130                 131             }132 133             if (cellTemplate != null)134             {135                 factory.SetValue(PropertyDefinition.CellTemplateProperty, cellTemplate);136                 dataTemplate.Seal();137 138             }139             else140             {141                 return null;142             }143             return dataTemplate;144         }145     }146 }
DynamicallyAssignDataEditorsTemplateSelector
##
using System.Collections.Generic;using System.ComponentModel;using System.Linq;namespace PropertyGridDemo.PropertyGridControl
{/// <summary>///初始化所有属性并调用模板选择器进行匹配/// </summary>public class DataEditorsViewModel
    {public IEnumerable<propertydescriptor> Properties { get { return TypeDescriptor.GetProperties(typeof(TestPropertyGrid)).Cast<propertydescriptor>(); } }
    }
}</propertydescriptor></propertydescriptor>
DataEditorsViewModel
3. Write a property CustomUIType that can be used to build templates:

using System;namespace PropertyGridDemo.PropertyGridControl
{public class CustomUIType
    {

    }public enum CustomUITypes
    {
        Slider,
        ComboBoxEit,
        SpinEdit,
        CheckBoxEdit
    }

    [AttributeUsage(AttributeTargets.Property)]internal class CustomUIAttribute : Attribute
    {public string DataContextPropertyName { get; set; }public CustomUITypes CustomUI { get; set; }/// <summary>/// 自定义控件属性构造函数/// </summary>/// <param>The UI types./// <param>Name of the data context property.internal CustomUIAttribute(CustomUITypes uiTypes, string dataContextPropertyName)
        {
            CustomUI = uiTypes;
            DataContextPropertyName = dataContextPropertyName;
        }
    }

}
CustomUIType
4 .Write the corresponding DataContext class TestPropertyGrid:

  1 using DevExpress.Mvvm.DataAnnotations;  2 using System;  3 using System.ComponentModel;  4 using System.ComponentModel.DataAnnotations;  5 using System.Timers;  6 using System.Windows;  7   8 namespace PropertyGridDemo.PropertyGridControl  9 { 10     [MetadataType(typeof(DynamicallyAssignDataEditorsMetadata))] 11     public class TestPropertyGrid : PropertyDataContext 12     { 13         private double _count = 0; 14         private SliderUIDataContext _countSource = null; 15         private ComboBoxEditDataContext _comboSource = null; 16         private double _value=1; 17  18         public TestPropertyGrid() 19         { 20             Password = "1111111"; 21             Notes = "Hello"; 22             Text = "Hello hi"; 23         } 24  25         [Browsable(false)] 26         public SliderUIDataContext CountSource 27         { 28             get 29             { 30                 if (_countSource != null) 31                 { 32  33                     return _countSource; 34                 } 35                 else 36                 { 37                     _countSource = new SliderUIDataContext(0, 100, Count, 0.1, 1); 38                     _countSource.PropertyChanged += (object o, PropertyChangedEventArgs e) => 39                     { 40                         this.Count = _countSource.Value; 41                     }; 42                     return _countSource; 43                 } 44             } 45         } 46  47         [Browsable(false)] 48         public ComboBoxEditDataContext ComboSource 49         { 50             get 51             { 52                 if(_comboSource==null) 53                 { 54                     _comboSource =new ComboBoxEditDataContext(ComboBoxEditItemSource.TestItemSource,Value); 55                     _comboSource.PropertyChanged += (object o, PropertyChangedEventArgs e) => 56                       { 57                           this.Value =Convert.ToDouble(_comboSource.EditValue.Item2); 
 58                       }; 59                     60                 } 61                 return _comboSource; 62             } 63         } 64  65         [Display(Name = "SliderEdit", GroupName = "CustomUI")] 66         [CustomUI(CustomUITypes.Slider, nameof(CountSource))] 67         public double Count 68         { 69             get => _count; 70             set 71             { 72                 _count = value; 73                 CountSource.Value = value; 
 74                 RaisePropertyChanged(nameof(Count)); 75             } 76         } 77  78         [Display(Name = "ComboBoxEditItem", GroupName = "CustomUI")] 79         [CustomUI(CustomUITypes.ComboBoxEit, nameof(ComboSource))] 80         public double Value 81         { 82             get => _value; 83             set 84             { 85                 if (_value == value) return; 86                 _value = value; 87                 //ComboSource.Value = value; 88                 RaisePropertyChanged(nameof(Value)); 89             } 90         } 91  92         [Display(Name = "Password", GroupName = "DefaultUI")] 93         public string Password { get; set; } 94  95         [Display(Name = "TextEdit", GroupName = "DefaultUI")] 96         public string Text { get; set; } 97  98         [Display(Name = "Notes", GroupName = "DefaultUI")] 99         public string Notes { get; set; }100 101 102         [Display(Name = "Double", GroupName = "DefaultUI")]103         [DefaultValue(1)]104         public double TestDouble { get; set; }105 106         [Display(Name = "Items", GroupName = "DefaultUI")]107         [DefaultValue(Visibility.Visible)]108         public Visibility TestItems { get; set; }109     }110 111     public static class DynamicallyAssignDataEditorsMetadata112     {113         public static void BuildMetadata(MetadataBuilder<testpropertygrid> builder)114         {115             builder.Property(x => x.Password)116                 .PasswordDataType();117 118             builder.Property(x => x.Notes)119                 .MultilineTextDataType();120         }121     }122 }</testpropertygrid>
TestPropertyGrid
Other classes used in this class mainly include The following classes are mainly used for data binding:

namespace PropertyGridDemo.PropertyGridControl
{public class SliderUIDataContext:PropertyDataContext
    {private double _value = 0;private double _max = 0;private double _min = 0;private double _smallChange = 1;private double _largeChange=1;public SliderUIDataContext()
        {

        }/// <summary>/// Initializes a new instance of the <see></see> class./// </summary>/// <param>The minimum./// <param>The maximum./// <param>The value./// <param>The small change./// <param>The large change.public SliderUIDataContext(double min, double max, double value,double smallChange=0.01,double largeChange=0.1)
        {
            SmallChange = smallChange;
            LargeChange = largeChange;
            Max = max;
            Min = min;
            Value = value;
        }/// <summary>/// Gets or sets the small change./// </summary>/// <value>/// The small change./// </value>public double SmallChange
        {get => _smallChange;set{if (value == _min) return;
                _min = value;
                RaisePropertyChanged(nameof(SmallChange));
            }
        }/// <summary>/// Gets or sets the large change./// </summary>/// <value>/// The large change./// </value>public double LargeChange
        {get => _largeChange;set{if (Value == _largeChange) return;
                _largeChange = value;
                RaisePropertyChanged(nameof(LargeChange));
            }
        }/// <summary>/// Gets or sets the maximum./// </summary>/// <value>/// The maximum./// </value>public double Max
        {get => _max;set{if (value == _max) return;
                _max = value;
                RaisePropertyChanged(nameof(Max));
            }
        }/// <summary>/// Gets or sets the minimum./// </summary>/// <value>/// The minimum./// </value>public double Min
        {get => _min;set{if (value == _min) return;
                _min = value;
                RaisePropertyChanged(nameof(Min));
            }
        }/// <summary>/// Gets or sets the value./// </summary>/// <value>/// The value./// </value>public double Value
        {get => _value;set{if (value == _value) return;
                _value = value;
                RaisePropertyChanged(nameof(Value));
            }
        }
    }
}
SliderUIDataContext
using System;using System.Linq;namespace PropertyGridDemo.PropertyGridControl
{public class ComboBoxEditDataContext:PropertyDataContext
    {private Tuple<string>[] _itemSource;private Tuple<string> _editValue;private int _selectedIndex;/// <summary>/// Initializes a new instance of the <see></see> class./// </summary>/// <param>The item source./// <param>The edit value.public ComboBoxEditDataContext(Tuple<string>[] itemSource,Tuple<string> editValue)
        {
            _itemSource = itemSource;
            _editValue = _itemSource.FirstOrDefault(x => x?.Item1.ToString() == editValue?.Item1.ToString() && x?.Item2?.ToString() == x?.Item2?.ToString());
        }/// <summary>/// Initializes a new instance of the <see></see> class./// </summary>/// <param>The item source./// <param>The value.public ComboBoxEditDataContext(Tuple<string>[] itemSource, object value)
        {
            _itemSource = itemSource;
            _editValue = _itemSource.FirstOrDefault(x => x?.Item2.ToString() == value.ToString() );
        }public string Name
        {get;set;
        }/// <summary>/// Gets or sets the item source./// </summary>/// <value>/// The item source./// </value>public Tuple<string>[] ItemSource
        {get => _itemSource;set{//if (_itemSource == value) return;_itemSource = value;
                RaisePropertyChanged(nameof(ItemSource));
            }
        }/// <summary>/// Gets or sets the edit value./// </summary>/// <value>/// The edit value./// </value>public Tuple<string> EditValue
        {get => _editValue;set{if (_editValue == value) return;
                _editValue = value;
                RaisePropertyChanged(nameof(EditValue));
            }
        }public object Value
        {set{
                EditValue = ItemSource.FirstOrDefault(x => x.Item2.Equals(value));
            }
        }/// <summary>/// Gets or sets the index of the selected./// </summary>/// <value>/// The index of the selected./// </value>public int SelectedIndex
        {get => _selectedIndex;set{if (_selectedIndex == value || value==-1) return;
                _selectedIndex = value;
                EditValue = ItemSource[value];
                RaisePropertyChanged(nameof(SelectedIndex));
            }
        }
    }
}</string></string></string></string></string></string></string>
ComboBoxEditDataContext
using System.ComponentModel;namespace PropertyGridDemo.PropertyGridControl
{public class PropertyDataContext:INotifyPropertyChanged
    {/// <summary>/// 在更改属性值时发生。/// </summary>public event PropertyChangedEventHandler PropertyChanged;/// <summary>/// 触发属性变化/// </summary>/// <param>public virtual void RaisePropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
PropertyDataContext
using System;namespace PropertyGridDemo.PropertyGridControl
{internal static class ComboBoxEditItemSource
    {internal static Tuple<string>[] TestItemSource = new Tuple<string>[] {new Tuple<string>("1",1),new Tuple<string>("2",2),new Tuple<string>("3",3)
        };
    }
}</string></string></string></string></string>
ComboBoxEditItemSource

5.将以上的CustomPropertyGrid丢进容器中即可,这里我直接用Mainwindow来演示:

 1 <window>14     <grid>15         <grid.columndefinitions>16             <columndefinition></columndefinition>17             <columndefinition></columndefinition>18         </grid.columndefinitions>19 20         <textbox21></textbox21>25         <custompropertygrid></custompropertygrid>26     </grid>27 </window>
MainWindow

 

运行示意图:

以上就是自定义PropertyGrid控件的实现代码,本人只实现了简单的Slider和ComboBoxEdit控件,实际上可以根据自己的需要仿照以上的方法扩展到其他控件,这个就看需求了。

个人感觉以上方案还是有所欠缺,主要是自定义控件的模板是由代码生成的,如果可以直接从资源文件中读取将会更加方便,不过本人尝试了几次并不能成功的实现数据的绑定,如果大家有什么好的解决方案欢迎在评论区留言,也欢迎大家在评论区进行讨论。

以上内容均为原创,转发请注明出处,谢谢!

 

The above is the detailed content of A very powerful control--PropertyGrid. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
C# .NET and the Future: Adapting to New TechnologiesC# .NET and the Future: Adapting to New TechnologiesApr 14, 2025 am 12:06 AM

C# and .NET adapt to the needs of emerging technologies through continuous updates and optimizations. 1) C# 9.0 and .NET5 introduce record type and performance optimization. 2) .NETCore enhances cloud native and containerized support. 3) ASP.NETCore integrates with modern web technologies. 4) ML.NET supports machine learning and artificial intelligence. 5) Asynchronous programming and best practices improve performance.

Is C# .NET Right for You? Evaluating its ApplicabilityIs C# .NET Right for You? Evaluating its ApplicabilityApr 13, 2025 am 12:03 AM

C#.NETissuitableforenterprise-levelapplicationswithintheMicrosoftecosystemduetoitsstrongtyping,richlibraries,androbustperformance.However,itmaynotbeidealforcross-platformdevelopmentorwhenrawspeediscritical,wherelanguageslikeRustorGomightbepreferable.

C# Code within .NET: Exploring the Programming ProcessC# Code within .NET: Exploring the Programming ProcessApr 12, 2025 am 12:02 AM

The programming process of C# in .NET includes the following steps: 1) writing C# code, 2) compiling into an intermediate language (IL), and 3) executing by the .NET runtime (CLR). The advantages of C# in .NET are its modern syntax, powerful type system and tight integration with the .NET framework, suitable for various development scenarios from desktop applications to web services.

C# .NET: Exploring Core Concepts and Programming FundamentalsC# .NET: Exploring Core Concepts and Programming FundamentalsApr 10, 2025 am 09:32 AM

C# is a modern, object-oriented programming language developed by Microsoft and as part of the .NET framework. 1.C# supports object-oriented programming (OOP), including encapsulation, inheritance and polymorphism. 2. Asynchronous programming in C# is implemented through async and await keywords to improve application responsiveness. 3. Use LINQ to process data collections concisely. 4. Common errors include null reference exceptions and index out-of-range exceptions. Debugging skills include using a debugger and exception handling. 5. Performance optimization includes using StringBuilder and avoiding unnecessary packing and unboxing.

Testing C# .NET Applications: Unit, Integration, and End-to-End TestingTesting C# .NET Applications: Unit, Integration, and End-to-End TestingApr 09, 2025 am 12:04 AM

Testing strategies for C#.NET applications include unit testing, integration testing, and end-to-end testing. 1. Unit testing ensures that the minimum unit of the code works independently, using the MSTest, NUnit or xUnit framework. 2. Integrated tests verify the functions of multiple units combined, commonly used simulated data and external services. 3. End-to-end testing simulates the user's complete operation process, and Selenium is usually used for automated testing.

Advanced C# .NET Tutorial: Ace Your Next Senior Developer InterviewAdvanced C# .NET Tutorial: Ace Your Next Senior Developer InterviewApr 08, 2025 am 12:06 AM

Interview with C# senior developer requires mastering core knowledge such as asynchronous programming, LINQ, and internal working principles of .NET frameworks. 1. Asynchronous programming simplifies operations through async and await to improve application responsiveness. 2.LINQ operates data in SQL style and pay attention to performance. 3. The CLR of the NET framework manages memory, and garbage collection needs to be used with caution.

C# .NET Interview Questions & Answers: Level Up Your ExpertiseC# .NET Interview Questions & Answers: Level Up Your ExpertiseApr 07, 2025 am 12:01 AM

C#.NET interview questions and answers include basic knowledge, core concepts, and advanced usage. 1) Basic knowledge: C# is an object-oriented language developed by Microsoft and is mainly used in the .NET framework. 2) Core concepts: Delegation and events allow dynamic binding methods, and LINQ provides powerful query functions. 3) Advanced usage: Asynchronous programming improves responsiveness, and expression trees are used for dynamic code construction.

Building Microservices with C# .NET: A Practical Guide for ArchitectsBuilding Microservices with C# .NET: A Practical Guide for ArchitectsApr 06, 2025 am 12:08 AM

C#.NET is a popular choice for building microservices because of its strong ecosystem and rich support. 1) Create RESTfulAPI using ASP.NETCore to process order creation and query. 2) Use gRPC to achieve efficient communication between microservices, define and implement order services. 3) Simplify deployment and management through Docker containerized microservices.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.